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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -