Question

Recently upgraded to XCode 4.5 I have a screen that's had 2 UIStepper controls on it for quite some time and all of a sudden they're appearing at twice the size that they should. Upon further testing, the same problem occurs when I add a UIStepper to any screen on my app. It appears fine on the StoryBoard but jumps to 2x when the app is run, both on the Device and in the Simulator. I tried manually setting the frame in viewWillAppear and that didn't fix it.

I created a new single view project to test adding just a UIStepper to the app and it works just fine there. I also tried copying/pasting the working UIStepper to my real app and it still appeared zoomed to 2x. Please Help!

Was it helpful?

Solution

I just found the line of code that causes the problem:

[[UIButton appearance] setBackgroundImage:imgBtn forState:UIControlStateNormal];

UIStepper is not a subclass of UIButton, but I'm guessing it uses two UIButtons internally. This must be a change with iOS6, as this code didn't effect UISteppers in iOS5.

Was able to resolve this by clearing the image from all UISteppers using it's appearance property:

[[UIStepper appearance] setBackgroundImage:nil forState:UIControlStateNormal];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top