rom*_*man 10
使用核心动画很容易
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:3.0f];
imageView.alpha = 0.0f;
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
如果你不想在3秒内慢慢褪色,你可以使用
[UIView setAnimationDelay:3];
Run Code Online (Sandbox Code Playgroud)
并将动画延伸减少到0.5f或其他东西.我认为使用短暂的淡出时间比仅仅将hide设置为YES更好
这将使它在三秒钟内淡出.从viewDidLoad调用:
[UIView animateWithDuration:3.0 animations:^{myImage.alpha = 0; }];
Run Code Online (Sandbox Code Playgroud)
或者如果你想让动画在2.5秒和最后半秒开始,你可以将它放入一个方法(改变3.0到0.5),然后调用:
[NSTimer scheduledTimerWithTimeInterval:2.5 target:self selector:@selector(hideMyImage) userInfo:nil repeats:no];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
13274 次 |
最近记录: |