我使用故事板并且有很多viewcontroller。我正面临着迎新问题。我尝试过不同的方法提供了stackoverflow。但我没有得到任何答案。 Xcode 6.0与ios 8有什么问题吗?
我的实施过程:
第1步:
我在Newscontroller.m中添加了以下代码
-(BOOL)shouldAutorotate {
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
- (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)self{
return UIInterfaceOrientationMaskPortrait;
}
现在的问题是......我需要禁用方向特定的视图控制器,比如只保留肖像。有人有想法吗?
答案 0 :(得分:0)
我的测试和工作:
在您的特定viewcontroller中,只有:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
return UIInterfaceOrientationPortrait;
}
答案 1 :(得分:0)
1)设置
-(BOOL)shouldAutorotate {
return YES;
}
2)添加
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
就是这样:))