【问题标题】:iPad orientation change - How to animate load of new nib/xibiPad 方向更改 - 如何为新 nib/xib 的加载设置动画
【发布时间】:2011-04-01 14:00:54
【问题描述】:
在 UIViewController 中,我使用 didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 检测视图的方向变化。然后,我使用 [[NSBundle mainBundle] loadNibNamed: owner: options:] 加载与正确设备方向相对应的 nib。工作正常,但看起来有点笨重。有没有办法让变化产生动画?谢谢。
【问题讨论】:
标签:
ipad
animation
ios4
xib
nib
【解决方案1】:
您可以使用 beginAnimations 包装您的更改,如下所示:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
forView:window cache:YES]; // You can change the effect
/*
* YOUR CODE HERE
*/
[UIView commitAnimations];