我创建了一个支持旋转的简单 iPad 应用程序。它有两个视图控制器。从 开始First View Controller
自动加载。它上面有一个按钮,单击该按钮时会将 的更改为。上面有一个按钮,它设置回。这项工作在人像模式下完美。但是当我将模拟器旋转到横向模式,并单击按钮加载时,它首先根据设备显示(未旋转),然后在完成动画后将显示旋转到正常(横向)。出了什么问题?设置方法如下:rootViewController
AppDelegate
rootViewController
AppDelegate
Second View Controller
Second View Controller
rootViewController
First View Controller
First View Controller
Second View Controller
Second View
AppDelegate
View Controllers
(void)loadSecondView
{
SecondView *secondViewController = [[SecondView alloc] initWithNibName:@"SecondView" bundle:nil];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.window cache:YES ];
self.window.rootViewController = secondViewController;
[UIView commitAnimations];
}
(void) removeSecondView
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.75];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.window cache:YES ];
self.window.rootViewController = self.firstViewController;
[UIView commitAnimations];
}