Question

I am using the following code :

[labelButton setTitle:@"title" forState:UIControlStateNormal];

Which is how you would change the text of the button, though, when I am changing it to something else:

[labelButton setTitle:@"title2" forState:UIControlStateNormal];

The button dims and then comes back. Is there a way to prevent this? Also, I am using iOS 7.

Was it helpful?

Solution

This is the behavior of a UIButton with a button type of UIButtonTypeSystem (the default button type) in iOS7. You will have to change the button type to Custom in your storyboard/xib , or if you're creating your button programmatically then create your button like this:

UIButton *labelButton = [UIButton buttonWithType:UIButtonTypeCustom];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top