【问题标题】:universal app with completely different layout具有完全不同布局的通用应用程序
【发布时间】:2015-01-29 10:17:12
【问题描述】:

我有一个成功完成并推送到 AppStore 的 iPhone 项目。现在我想将该项目更改为通用项目。但问题是 iPhone 布局和 iPad 布局完全不同。在 iPhone 中我有共同的设计,但在 iPad 中它是作为 SplitViewController 出现的。实际上问题出在 xcode 6 中,我们正在处理自动布局和大小类。我们只有一个storyBoard来处理iPhone界面和iPad界面。我不知道如何实现这一点。当 iPhone 有其他设计时,实现 SplitView 并为 iPad 配置它。!

如果有人已经从事过此类项目,请告诉我您的建议。提前致谢。

【问题讨论】:

    标签: ios iphone xcode ipad swift


    【解决方案1】:

    我处理过相同类型的项目,其中我有不同的 iPhone 和 iPad 设计。虽然默认情况下 iPhone 和 iPad 通常使用一个故事板,但我添加了一个额外的故事板并分别为 iPhone 和 iPad 设计它们,并且在 AppDelegate's applicationDidFinishLaunching 方法中,我有条件地根据设备加载故事板( iphone或ipad)。

    if ([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad) {
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main~iPad" bundle:nil];
        UIViewController *initViewController = [storyboard instantiateInitialViewController];
        [self.window setRootViewController:initViewController];
    }
    else{
        UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        UIViewController *initViewController = [storyboard instantiateInitialViewController];
        [self.window setRootViewController:initViewController];
    }
    

    应用程序目前在 AppStore 中上线,没有任何问题。希望这种方法对您有所帮助

    【讨论】:

    • 你确定这可以通过 xcode 6 来完成吗?当尺寸等级可用时。?
    • 是的,我很确定版本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    相关资源
    最近更新 更多