在现在做的iPad项目中,我们采用的是一个controller对应2个view。
一个view是默认的。
一个view是自己创建的,用于旋转屏幕后显示。
对应的代码为:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationPortrait ||
toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
[viewLandscape_ removeFromSuperview];
}
else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[self.view addSubview:viewLandscape_];
}
}
用上面这个方法主要是在旋转过程中执行,画面更加流畅。