ios 9 objective-c screen size issues

假装没事ソ 提交于 2019-12-28 04:33:28

问题


I upgrade to ios 9 and xcode 7 (from xcode 6.2) and now this happens when I start my app:

There is now all this black bars above and below.

My appDelegate is like so:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.
    // self.window.backgroundColor = [UIColor whiteColor];
    // [self.window makeKeyAndVisible];



    _startViewController = [[StartViewController alloc] init];
    _startNavigationController = [[StartNavigationController alloc] initWithRootViewController:_startViewController];
    self.window.rootViewController = _startNavigationController;
    [self.window makeKeyAndVisible];

    // Need to fix this since deprecated
    // [application prefersStatusBarHidden:NO];
    // [application preferredS :UIStatusBarStyleDefault];

    // [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

    return YES;
}    

回答1:


case was missing the LaunchScreen.storyboard in General setting under App icons and launch images:

above function is not work check the follow the below steps:

  1. Navigate to project settings
  2. Under "App Icons and Launch Images" click on "Use Asset Catalog"
  3. Select "Migrate" on the popup that appears.

This should fix the issue.




回答2:


First of all please add these images at your Images.xcassets directory. You can also change these images but be careful to keep sizes and titles :)

Name them with their titles. Default.png

Default-Portrait-736h@3x.png

Default-667h@2x.png

Default-568h.png

Then select LaunchImage at General : App Icons and Launch Images : Launch Images Source




回答3:


Check your project if it has LaunchScreen.storyboard file. Without this Xcode is making an assumption about your screen size. Create a LaunchScreen.storyboard file and add it to your project.




回答4:


If you don't want to add any splash screen if it doesn't serve any purpose like if it is white or black in that case you can simply add launchScreen.xib and select it Launch screen file option Target setting.



来源:https://stackoverflow.com/questions/32964581/ios-9-objective-c-screen-size-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!