从AppDelegate加载Storyboard会在窗口上留下黑色空间

时间:2014-12-28 13:53:48

标签: ios iphone storyboard appdelegate

我正在Storyboard发布AppDelegate,但屏幕顶部和底部会出现黑色空间。这是我的代码:

- (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;
}  

这是它的样子:

enter image description here

1 个答案:

答案 0 :(得分:1)

这可能是由于您没有Default-568h@2x.png启动图像。

尝试添加一个或使用资产目录中的启动图像,并为iPhone 5大小设置一个。

(也是:self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];是必要的,它会返回你期望的吗?)