Launching into portrait-orientation from an iPhone 6 Plus home screen in landscape orientation results in wrong orientation

前端 未结 13 1762
南方客
南方客 2020-12-22 23:21

The actual title for this question is longer than I can possibly fit:

Launching an app whose root view controller only supports portrait-orientation but which otherw

13条回答
  •  不知归路
    2020-12-22 23:47

    Please try the following code. Probably this problem caused by size of keywindow on landscape launch.

    // in application:didFinishLaunchingWithOptions: ...
    
    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    [self.window setFrame:[[UIScreen mainScreen] bounds]]; //<- ADD!!
    

提交回复
热议问题