使用Rotation,iOS处理切换ViewControllers的最佳方法

时间:2014-08-18 04:21:54

标签: ios rotation orientation

我目前的观点是肖像,显示特定的设计。当我横向旋转它时,我想切换到一个新设计,特别是一个新的ViewController,带有新的.h / .m文件。

我应该这样接近吗?有人能指出我正确的方向吗? 旋转可以触发segue吗?

1 个答案:

答案 0 :(得分:0)

-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
    NSLog(@"Landscape left");
   //Present or dismiss your new view controller accordingly 
} else if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
    NSLog(@"Landscape right");
    //Present or dismiss your new view controller accordingly 
} else if (toInterfaceOrientation == UIInterfaceOrientationPortrait) {
    NSLog(@"Portrait");
   //Present or dismiss your new view controller accordingly  
} else if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
    NSLog(@"Upside down");
   //Present or dismiss your new view controller accordingly  
}
}