我正在从 AppDelegate
启动 Storyboard
,但屏幕顶部和底部出现黑色空间。这是我的代码:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *vc =[storyboard instantiateInitialViewController];
// Set root view controller and make windows visible
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = vc;
[self.window makeKeyAndVisible];
return YES;
}
它是这样的:
最佳答案
这可能是因为您没有 Default-568h@2x.png 启动图像。
尝试添加一个或使用 Assets 目录中的启动图像,并为 iPhone 5 尺寸准备一个。
(也是:self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
是必要的,它会返回你期望的吗?)
关于ios - 从 AppDelegate 加载 Storyboard 在窗口上留下黑色空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27677047/