iOS中不同的启动画面

时间:2016-09-04 20:12:38

标签: swift swift2

通过applicationDelegate我有不同的故事板用于不同的分辨率。我可以为发布屏幕做同样的事情吗?

2 个答案:

答案 0 :(得分:0)

根据讨论here

,似乎不再有多个文件了

推荐的方法是创建通用故事板。你可以看看如何去做here

答案 1 :(得分:-1)

此解决方案来自博客帖子How to load UIStoryboards depending on screen height in iOS

- (UIStoryboard *)grabStoryboard {

    // determine screen size
    int screenHeight = [UIScreen mainScreen].bounds.size.height;
    UIStoryboard *storyboard;

    switch (screenHeight) {

            // iPhone 4s
        case 480:
            storyboard = [UIStoryboard storyboardWithName:@"Main-4s" bundle:nil];
            break;

            // iPhone 5s
            case 568:
            storyboard = [UIStoryboard storyboardWithName:@"Main-5s" bundle:nil];
            break;

            // iPhone 6
            case 667:
            storyboard = [UIStoryboard storyboardWithName:@"Main-6" bundle:nil];
            break;

            // iPhone 6 Plus
            case 736:
            storyboard = [UIStoryboard storyboardWithName:@"Main-6-Plus" bundle:nil];
            break;

        default:
            // it's an iPad
            storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
            break;
    }

    return storyboard;
}