ios - 2 个不同的纵向和横向 Storyboard

标签 ios xcode storyboard uistoryboard

是否可以创建 2 个 Storyboard并根据设备方向访问每个 Storyboard?我尝试了这段代码:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;

    if (UIInterfaceOrientationPortrait){
              UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Storyboardland.storyboard"];


    }else if (UIInterfaceOrientationPortraitUpsideDown){
        UIStoryboard *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"MainStoryboard_iPad.storyboard"];

    }}

...但不起作用?我犯了什么错误吗??

最佳答案

我认为this answer to a previous post (iPhone Storyboard: different scene for portrait and landscape)可能会解决你的问题。它解释了如何为纵向和横向模式提供不同的 View ,但仍然使用相同的 View Controller 。

关于ios - 2 个不同的纵向和横向 Storyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9647548/

相关文章:

iphone - 无法在 UITableViewCell 中设置自定义背景颜色

ios - 关于一行中连续声明的 Swift 错误

ios - Xcode 在打开 .xcodeproj 文件时崩溃

ios - 如何让 iAdBannerView 拉伸(stretch)到自适应布局 Storyboard的整个宽度 xcode 6

ios - 如果已经授权,如何跳过登录场景直接从下一步开始?

ios - NBA 数据 JSON 解析 Swift

ios - 避免基于框架的重叠 View

ios - 当我单击 WKWebView 浏览器中的链接时,它会转到 safari

xcode - 有没有办法在 Xcode 8.1 中模拟 2016 MacBook Pro Touch Bar?

xcode - 编译失败的 Storyboard