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.

Était-ce utile?

La 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];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top