Custom UIWindows do not rotate correctly in iOS 8

前端 未结 4 589
情歌与酒
情歌与酒 2021-02-05 12:46

Get your application into landscape mode and execute the following code:

UIWindow *toastWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];         


        
4条回答
  •  广开言路
    2021-02-05 13:21

    The best thing to do is use views instead of windows:

    Most iOS applications create and use only one window during their lifetime. This window spans the entire main screen [...]. However, if an application supports the use of an external display for video out, it can create an additional window to display content on that external display. All other windows are typically created by the system

    But if you think you've got a valid reason to create more than one window, I suggest you create a subclass of NSWindow that handles sizes automatically.

    Also note that windows use a lot of RAM, especially on 3x retina screens. Having more than one of them is going to reduce the amount of memory the rest of your application can use before receiving low memory warnings and eventually being killed.

提交回复
热议问题