almerlucke / FCOverlayViewController

Having a hard time presenting overlays like login screens, alerts, huds? Use FCOverlay to present your view controllers on top of everything else in a freshly created window. Make your life easier, use FCOverlay!
MIT License
48 stars 10 forks source link

Status bar & Orientation issue #4

Open Mazyod opened 10 years ago

Mazyod commented 10 years ago

Hi,

This is by far the best starting point for developers looking to manage overlays. It needs more contributors! (Maybe through posting some answers on stackoverflow or something).

In any case, the issue..

After presenting an overlay of a view controller that prefers landscape orientation, the presenting view would seem to get kind of stuck with landscape after the overlay is dismissed.

Here is a very simple project I created (Updated):

https://www.dropbox.com/s/ve3udnhtke5454l/TestOverlay.zip

You can see in the app that the red controller supports only portrait and doesn't auto rotate, and yet it gets a landscape status bar when the overlay is dismissed.

Mazyod commented 10 years ago

Oops, sorry, I was a bit hasty with this one. The sample project is wrong. I'll dig deeper to see what my issue is.

Issue updated above.

almerlucke commented 10 years ago

Hi Mayzod,

I checked the project and see your point. I'm looking into it now, with normal view controller presentations the orientation is restored after dismissal, so I need to see if there is a way to force back the view controller that presented the overlay to it's preferred orientation. Keep you updated...

Gr. Almer

almerlucke commented 10 years ago

My first informed report: we can set the orientation back if needed by comparing the status bar orientation when the overlay was dismissed and the supported interface orientations of the topmost view controller in the window that is restored. If the current orientation of the status bar is supported we do not need to do anything, otherwise we have to force back the status bar orientation to the closest one that is supported. The closest one that is supported is debatable and there is the iOS6/7 difference so I feel there are edge cases coming up with this one, but I will try to play around and see what works.

Mazyod commented 10 years ago

Thanks for looking into this. I actually took a stab at it, and it was so painful, I ended up not using FCOverlay for that specific use case.