UISlider Disappeared in iOS 8.3 - xcode6

UISlider *slider = [[UISlider alloc] initWithFrame:CGRectMake(50, 50, 100, 40)];
[self.view addSubview:slider];
The problem is that, I cannot view UISlider at all but I can still drag it. I have to guess the position and drag.
The compile environment is based on ios 6 sdk (mandatory because my app doesn't use flat yet)
Does anybody know how to fix this? Thank you very much.

I've also experienced this with an iOS 6.1 application running on iOS 8.3.
It appears that Apple have cleaned up the image resources which are for the old iOS appearance. I'm not sure if this was a mistake or intentional.
I found a solution to the issue using the methods provided to customise the appearance of the control which are detailed in the UISlider class reference.
Here's my code:
[self.myControl setThumbImage:[UIImage imageNamed:#"thumb.png"] forState:UIControlStateNormal];
[self.myControl setMaximumTrackImage:[UIImage imageNamed:#"background.png"] forState:UIControlStateNormal];
[self.myControl setMinimumTrackImage:[UIImage imageNamed:#"highlight.png"] forState:UIControlStateNormal];
I was able to re-create the standard appearance relatively easily.
I hope this helps.

Related

Changing backgroundcolor of a view seems hard?

I want to change the background color of a view within the view controller. Selecting the view and opening the attributes inspector isn't showing that much. Should have an option here for the background.
Tried coding it within the (void)viewDidLoad{} with: self.view.backgroundColor = [NSColor blueColor]; That isn't working either, no object of NSView.
What am I doing wrong? I read that the coding problem probably has something to with the newer version of Xcode. coding issue
This is already questioned and answered in
Best way to change the background color for an NSView
Here the code for OS X
[self.view setWantsLayer:YES];
[self.view.layer setBackgroundColor:[[NSColor whiteColor] CGColor]];
wich xcode version are you using? This is how I change the backgroun color using the attributes inspector in Version 7.1 (7B91b)

iOS 7.1 Breaks UITabbar Images Selected State

Since updating to iOS 7.1, my tab bar images initialize as if they were all active, they are all highlighted on launch. Once I visit each tab, that tab image resets and displays correctly. Has anyone else seen this behavior? Suggestions for work around?
I rolled back my xcode to version 5.0, which the only old version i have and build the app using it. It works perfectly on iOS7.1 device now.
If you have the xcode version 5.0.2 that would be great also.
In my case, as I finally figured out, this issue was caused by setup of appearance protocol on UIView in my style controller which is called at startup.
I had been setting an overall tint color for UIView. It did not apply to the icons in iOS7.0 but that must have changed in 7.1.
My style code:
// Color for buttons and enabled controls
UIView *viewAppearance = [UIView appearance];
[viewAppearance setTintColor:overallTintColor];
I added this to fix:
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor darkGrayColor]];
darkGrayColor is not ideal, I just threw it in there for testing. I tried using nil, as I would like it to just go back to the default as it used to. Giving nil as a color did not have any effect. I suppose I will play with some color values until I get a close match.

UIPopoverController and Keyboard on iOS 7 results on strange animation

On iOS 7, when you present a UIPopoverController, the system adds a UIView with some alpha effect to focus the user on the UIPopoverController. So far, so good.
The problem is that if you have a UIPopoverController that's being displayed from the bottom of your screen, and that UIPopoverController content has a UITextField (or anything else that brings the keyboard), the dimmed UIView animation doesn't follow the keyboard very well.
I've created a sample project to isolate the problem. Download Project
And a video of the same issue running on the simulator: Watch Movie
One solution could be to just disable the dimmed UIView as mentioned here, but I would like to keep it if possible.
Is there a workaround or maybe I'm doing something wrong?
I'm starting to consider to fill a bug for this.
Thanks.
Have you tried wrapping your code in a block to disable CoreAnimations implicit animation blocks? Something like this
[CATransaction begin];
[CATransaction setDisableActions: YES];
// Show your popover:
// [myPopover presentPopover:...]
[CATransaction commit];

Background image of back button does not appear before it is touched iOS 7

I am experiencing some problems with [UIBarButtonItem appearance] for the the back button background image.
Normally (iOS 5 and iOS 6) I was able to set the background image of the back button like this:
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
But at iOS 7 the background image does not appear on the back button. The weird thing is, that the background image actually appears when the back button has been touched once.
I have tried setting the image for all states, to test if iOS 7 was using some kind of new state for an untouched back button, but that does not seem to be the case.
Do you have any idea, what I am doing wrong?
A solution which will make the background appear correctly on iOS7 is at OS 7 custom back button. It swizzles a method to fix the Apple bug (which is that they forget to call setNeedsDisplay on the private view when the background image is changed). Going borderless is probably better, if possible, but swizzling does work.
I searched for this problem and found that you are not the only one to have the same problem. There are many others who face the same issue with UIAppearance. These are the proofs (to explain you to your client) :
UIBackButton Background Image not appearing
Back button is not visible in iOS 7
In this case, what you can do is to follow the Answer provided in the 2nd Link.
You can either set the backIndicatorImage property on UINavigationBar to a custom image or you can change the color of the backIndicatorImage by setting the tintColor property on UINavigationBar.
You can create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem.
try to change the tint color of the button. There is some issue in iOS 7 for UIBarButton
I implemented a really nice solution that works under ios5+ here:
Back button item strangely disappearing under iOS7
To work with ios7 you need to use
UIImage *backButton = [[UIImage imageNamed:#"icon_back" resizableImageWithCapInsets:UIEdgeInsetsZero];
if ([UINavigationBar instancesRespondToSelector:#selector(setBackIndicatorImage:)]) {
[[UINavigationBar appearance] setBackIndicatorImage:backButton];
[[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backButton];
}else{
//ios 5 and 6 code
}

How to access the current cordinate of UIButton from the super view, when occur the UIGestureRecognizerStateEnd

I am new to iOS development. Now I am implementing an UIPanGestureRecognizer model application. I have one UIButton for UIPanGestureRecognizer. My question is, how can access the reside coordinate of UIButton from the super view (such as UIView, UIScrollView etc?)
if anybody know please help me.
You may use
CGRect rectInSuperView = [button convertRect:button.frame toView:superview];
Check the documentation