OGeek|极客世界-中国程序员成长平台

标题: ios - 2个不同的纵向和横向 Storyboard [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 21:53
标题: ios - 2个不同的纵向和横向 Storyboard

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

- (BOOL)shouldAutorotateToInterfaceOrientationUIInterfaceOrientation)interfaceOrientation
{
    return YES;

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


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

    }}

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



Best Answer-推荐答案


我认为 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/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4