[英]Best way to handle switching ViewControllers with Rotation, iOS
My current view is portrait, displaying a particular design. 我当前的视图是肖像,显示特定的设计。 When I rotate it landscape wise, I want to switch to a new design, and in particular a new ViewController, with new .h/.m files.
当我将其横向旋转时,我想切换到具有新的.h / .m文件的新设计,尤其是新的ViewController。
Should I be approaching it this way? 我应该这样处理吗? Can someone point me in the right direction?
有人可以指出我正确的方向吗? Can a rotation trigger a segue?
旋转可以触发segue吗?
-(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
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.