Dam*_*bin 5 iphone animation rotation
当我的iPhone界面旋转时,我想为UIViewController的特定UIView做淡入/淡出......就像......
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
theView.alpha = 0;
[UIView commitAnimations];
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3];
theView.alpha = 1;
[UIView commitAnimations];
}
Run Code Online (Sandbox Code Playgroud)
但动画在旋转开始之前没有完成(我们可以看到视图开始自我调整大小)......
有没有办法延迟旋转开始?
"持续时间"是旋转动画的持续时间,对吧?
我发现当前运行循环运行的时间与前一个动画相同,确实延迟了旋转.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
[UIView animateWithDuration:0.25 animations:^{
theview.alpha = 0.0;
}];
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.25]];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1301 次 |
| 最近记录: |