【发布时间】:2015-01-05 15:17:31
【问题描述】:
我正在为 Iphone 和 Ipad 加载不同的情节提要,并且 Iphone 的情节提要加载良好,但是当我启动 Ipad 模拟器时,我得到了“应用程序窗口是预期的...”错误。
这是 AppDelegate 中的代码:
@implementation AppDelegate
- (UIStoryboard *)grabStoryboard {
UIStoryboard *storyboard;
// detect the height of our screen
int height = [UIScreen mainScreen].bounds.size.height;
if (height == 480) {
storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Iphone3" bundle:nil];
// NSLog(@"Device has a 3.5inch Display.");
}
if (height >= 1024 && height <= 2048 ) {
storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Ipad" bundle:nil];
NSLog(@"Device has a 4inch Display.");
}
else {
storyboard = [UIStoryboard storyboardWithName:@"Storyboard_Iphone4Up" bundle:nil];
// NSLog(@"Device has a 4inch Display.");
}
return storyboard;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIStoryboard *storyboard = [self grabStoryboard];
// show the storyboard
self.window.rootViewController = [storyboard instantiateInitialViewController];
[self.window makeKeyAndVisible];
return YES;
}
在控制台中,我看到 NSLog 消息,但情节提要未加载,并且出现“应用程序窗口...”错误。
我正在使用一些滚动视图和一些元素,但我认为这些不是问题,因为它们有一个选项“调整滚动视图插图”。
我上传了一些屏幕截图来展示我的项目的更多信息。感谢您的宝贵时间。
【问题讨论】:
标签: ios iphone xcode ipad storyboard