iPad方向更改-如何设置新nib/xib加载动画

iPad方向更改-如何设置新nib/xib加载动画,ipad,animation,ios4,xib,nib,Ipad,Animation,Ios4,Xib,Nib,在UIViewController中,我使用InterfaceOrientation中的didRotateFromInterfaceOrientation:(UIInterfaceOrientation)检测视图的方向变化。然后,我使用[[NSBundle mainBundle]loadNibNamed:owner:options:]加载对应于正确设备方向的nib。工作正常,但看起来有点笨重。是否有一种方法可以使更改动画化?谢谢 您可以用beginAnimations包装您的更改,如下所示: [

在UIViewController中,我使用InterfaceOrientation中的didRotateFromInterfaceOrientation:(UIInterfaceOrientation)检测视图的方向变化。然后,我使用[[NSBundle mainBundle]loadNibNamed:owner:options:]加载对应于正确设备方向的nib。工作正常,但看起来有点笨重。是否有一种方法可以使更改动画化?谢谢

您可以用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];