【发布时间】:2011-11-21 18:22:04
【问题描述】:
我正在尝试使用 UILabel 淡入淡出来构建对我的应用程序的介绍。我有两个标签。我想让第一个淡入,在屏幕上停留 4 秒钟。然后第二个标签应该淡入并在屏幕上停留 4 秒钟。然后它应该淡出两个标签。
我有以下代码,但它没有做任何事情,因为它直接进入最终状态。我在 viewDidAppear() 中有以下方法。我做错了什么?
-(void) animateLabels
{
[UIView beginAnimations:@"First Label Display" context:nil];
[UIView setAnimationDelay:4.0];
firstLabel.alpha = 1;
[UIView commitAnimations];
[UIView beginAnimations:@"Second Label Display" context:nil];
[UIView setAnimationDelay:6.0];
secondLabel.alpha = 1;
[UILabel commitAnimations];
[UIView beginAnimations:@"Hide Labels" context:nil];
[UIView setAnimationDelay:10.0];
secondLabel.alpha = 0;
firstLabel.alpha=0;
[UILabel commitAnimations];
}
【问题讨论】:
-
你可能想看看我对stackoverflow.com/questions/1684200/…的回答
-
你混淆了 setAnimationDelay 和 setAnimationDuration
标签: ios objective-c core-animation uilabel fade