ios - Lock status bar orientation in separate UIWindow -


i have case need create new uiwindow inside application. want new window locked in portrait orientation, app's original window should not locked in portrait orientation.

i setting new window so:

newwindow = uiwindow(frame: cgrect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height)) newwindow?.rootviewcontroller = viewcontroller2() newwindow?.makekeyandvisible() 

and viewcontroller2 locks orientation with:

override var shouldautorotate: bool {     return false } 

the problem is, when new window shown, , user rotates device, app lock in portrait, status bar rotate landscape mode: enter image description here

how can make sure status bar locks in portrait inside new window?

in case wants see in action in simple project: https://github.com/rajohns08/statusbar

use documentation problem https://developer.apple.com/reference/uikit/uiinterfaceorientationmask

or solution in app delegate. can handle supported orientations every window separately, there:

- (nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window {    // check, window asking , return mask    return uiinterfaceorientationmaskallbutupsidedown; } 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -