XCODE故事板,横向视图

XCODE故事板,横向视图,xcode,nib,landscape,Xcode,Nib,Landscape,我用故事板创建了一个应用程序,并将其设计为景观 在view controller.m文件中,我放置了以下代码: - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrien

我用故事板创建了一个应用程序,并将其设计为景观

在view controller.m文件中,我放置了以下代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||
        (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
我也尝试过该代码的一百万种变体,都得到了相同的结果


此外,我还更改了info.plist中支持的方向,当然,我还制作了故事板。但是,当我进行模拟时,最初的启动是在横向中,然后子导航窗口会捕捉回纵向。所以,我的问题是,当使用故事板时,我如何覆盖肖像默认值,意思是没有笔尖?我对制作应用程序还不熟悉,所以对于你们这些家伙和你们巨大的大脑来说,这可能是一件非常简单的事情,所以我觉得这是值得一问的。我准备接受你的笑声,并为我的新手行为指指点点。=]

您是否将覆盖shouldAutorotateToInterfaceOrientation方法的自定义控制器类与情节提要中的场景相关联?如果没有,则需要确保在序列图像板编辑器中场景的标识检查器的“自定义类”部分中引用该类

我喜欢在shouldAutorotateToInterfaceOrientation方法中使用此说明,以确保仅支持横向:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return UIDeviceOrientationIsLandscape(interfaceOrientation);
}
您可以将本教程作为ios5中故事板的介绍: