문제

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