方向实施问题故事板

时间:2015-03-01 15:53:05

标签: objective-c iphone xcode swift storyboard

我使用故事板并且有很多viewcontroller。我正面临着迎新问题。我尝试过不同的方法提供了stackoverflow。但我没有得到任何答案。 Xcode 6.0与ios 8有什么问题吗?

我的实施过程:

第1步:enter image description here

我在Newscontroller.m中添加了以下代码

-(BOOL)shouldAutorotate {
    return NO;
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)self{
    return UIInterfaceOrientationMaskPortrait;
}

现在的问题是......我需要禁用方向特定的视图控制器,比如只保留肖像。有人有想法吗?

2 个答案:

答案 0 :(得分:0)

我的测试和工作:

在您的特定viewcontroller中,只有:

-(NSUInteger)supportedInterfaceOrientations 
{
    return UIInterfaceOrientationMaskPortrait;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
    return UIInterfaceOrientationPortrait;
}

答案 1 :(得分:0)

1)设置

-(BOOL)shouldAutorotate {
    return YES;
}

2)添加

-(NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskPortrait;
}

就是这样:))