سؤال

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.

هل كانت مفيدة؟

المحلول

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];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top