我想在2 viewController和1 viewController中强制使用纵向模式,我尝试过旧的技术,但这些技术在ios9中不起作用
发布于 2016-06-27 17:28:55
很可能您已经在info.plist中定义了一些允许的方向。您应该在那里选中并删除任何条目,因为我相信这些条目将覆盖项目中的任何其他值。
然后,您应该能够设置每个VC的方向,如下所示:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscapeRight;
}
-(BOOL)shouldAutorotate {
return NO;
}我认为你需要的关键是Supported interface orientations。
发布于 2016-06-27 17:39:14
您可以从Xib/Storyboard设置视图控制器的方向,因为每个视图控制器都有属性" orientation“
并实现下面给出的方法
-(BOOL)shouldAutorotate
{
return NO;
}发布于 2016-06-27 20:33:59
您可以在viewDidAppear方法中将方向设置为bellow
NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];https://stackoverflow.com/questions/38050240
复制相似问题