在这里我找到了如何制作动画UIButton
的标题更改使用现已弃用beginAnimations:context:
method:
iPhone 的 UIBUtton 标题动画 https://stackoverflow.com/questions/11709147/uibutton-title-animation-for-iphone
如何使用当前的 API 做同样的事情?
Update:
我尝试使用基于块的动画:
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];
颜色变化不是动画的。
使用块:
[UIView transitionWithView:self.flipLabelButton duration:1 options:UIViewAnimationOptionTransitionFlipFromRight animations:^{
[self.flipLabelButton setTitle:newText forState:UIControlStateNormal];
} completion:nil];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)