在这里,我找到了如何UIButton使用现已弃用的beginAnimations:context:方法来动画的标题更改:
如何使用当前的API做同样的事情?
更新:
我试过使用基于块的动画:
NSTimeInterval animationDuration = animated ? 1.f : 0.f;
[UIView animateWithDuration:animationDuration delay:0.f options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction animations:^{
[button setTitle:newTitle forState:UIControlStateNormal];
[button setTitleColor:newTitleColor forState:UIControlStateNormal];
} completion:nil];
Run Code Online (Sandbox Code Playgroud)
颜色更改不是动画.