How to stop unwanted UIButton animation on title change?

前端 未结 24 2701
面向向阳花
面向向阳花 2020-11-28 19:07

In iOS 7 my UIButton titles are animating in and out at the wrong time - late. This problem does not appear on iOS 6. I\'m just using:

[self setTitle:text fo         


        
24条回答
  •  旧巷少年郎
    2020-11-28 19:32

    You can simply create Custom button and it will stop animate while changing the title.

            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            [btn setTitle:@"the title" forState:UIControlStateNormal];
    

    you also can do it in Storyboard checkbox: select the button in storyboard -> select the attributes inspector (fourth from left side) -> in the 'Type' drop down menu, select 'Custom' instead of 'System' that was probably selected.

    Good luck!

提交回复
热议问题