通过applicationDelegate
我有不同的故事板用于不同的分辨率。我可以为发布屏幕做同样的事情吗?
答案 0 :(得分:0)
答案 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; }