在 Cocoa Touch 中制作 UILabel 动画的更好方法?
过去,当我想做一个从一个 UILabel 文本到另一个 UILabel 文本的漂亮淡入淡出动画时,我会加入以下内容:
[UIView beginAnimations:@"fade" context:nil];
[UIView setAnimationDuration:0.25];
myLabel.alpha = 0.0;
myLabel.text = @"Different string";
myLabel.alpha = 1.0;
[UIView commitAnimations];
正如您可能会说的那样,标签会快速淡出,更改内容,然后淡入。
我在其他应用程序中看到过一些实例,其中文本似乎非常平滑地淡出 - 而不会出现快速淡出和返回的情况。
是我一个人的问题还是有更好的方法来实现这一目标?
谢谢。 瑞奇。
In the past, when I've wanted to do a nice fade animation from one UILabel text to another, I chuck in the following:
[UIView beginAnimations:@"fade" context:nil];
[UIView setAnimationDuration:0.25];
myLabel.alpha = 0.0;
myLabel.text = @"Different string";
myLabel.alpha = 1.0;
[UIView commitAnimations];
As you can probably tell, the label does a quick fade out, change content, then fades back in.
I've seen some instances in other apps where the text just seems to fade really smoothly - without appearing to fade out and back in quickly.
Is it just me or is there a better way of achieving this?
Thanks.
Ricky.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
希望这有帮助。
Hope this helps.