Closed efimovdk closed 8 years ago
You're welcome! I believe it has to do with windowLevel
of the private window. I'll spend some time on it later today.
Sorry for the delay. I put in a fix and pushed out a new version of the pod. Feel free to pull down the repo or use version 0.2.0.
I'll close the issue if I don't hear back in a few days. Thanks again.
Thanks for the useful pod! I'm having a similar issue that is caused by the behavior introduced in 0.2.0.
I have a view controller transition that involves view based status bar presentation for two view controllers (let's call them A and B): A (prefersStatusBarHidden -> true) -> B (prefersStatusBarHidden -> false). Without showing an alert the status bar behavior is correct in that it is hidden in A and visible in B, but when I show a DBAlertController during the transition from A -> B then B's view frame is negative y offset by the height of the status bar. This causes the status bar to appear on top of the navigation bar while the alert is visible. When the alert is dismissed, B keeps it's incorrect offset and B's status bar is hidden.
My understanding of this problem is that
private override func prefersStatusBarHidden() -> Bool {
return UIApplication.sharedApplication().statusBarHidden
}
is returning the prefersStatusBarHidden()
for A when it should be consulting B causing B to be incorrectly hidden.
Hey thanks for the information!
If I'm understanding you correctly, you're using view controller-based status bar appearance. DBAlertController does not currently have support for this feature. We would need a reference to the visible view controller to get the current status bar properties, but DBAlertController essentially just adds a new UIWindow to the top of the view hierarchy (without looking at the visible view controller).
I have a fix in mind, but I'm going to consider all the options before applying the fix. Suggestions are welcome!
Maybe I misunderstood. I see this which leads me to believe the intention is to support view controller-based status bar appearance.
// In the case of view controller-based status bar style, make sure we use the same style for our view controller
private class DBClearViewController: UIViewController {
private override func preferredStatusBarStyle() -> UIStatusBarStyle {
return UIApplication.sharedApplication().statusBarStyle
}
private override func prefersStatusBarHidden() -> Bool {
return UIApplication.sharedApplication().statusBarHidden
}
}
Actually I just created a sample project and i'm unable to reproduce the issue. This might be an incompatibility with RESideMenu
. I'm looking into it now.
Just realized that what I said may be wrong. UIApplication.sharedApplication().statusBar...
may actually be the right value depending on when it's called (i.e. calling it right before the alert is presented may get the correct value).
Let me know what you figure out with RESideMenu.
Correction: Just realized what I said is completely wrong. Sorry, I'm going down a rabbit hole for a different project, so my mind is a little scrambled at the moment.
Thank you for this convenient class. Everything works fine except one thing. What if I want to keep
UIStatusBar
preferences(light or dark, hidden or not) of current view controller when I show alert above it? Suppose I have aUIViewController
withUIStatusBarStyleLightContent
. When I show alert view, it becomes black. I have different scenarios in my app, so it is really really bad to do all that stuff manually by saying: ifAViewController
is below then light bar, ifBViewController
than the bar is hidden, ifC
and so on. Any advices to this?