When avoiding the status bar, check the view's position relative to the status bar rather than assuming that the presence of a presentingViewController is sufficient; otherwise we would not avoid the status bar in full screen modal views.

This commit is contained in:
Evan D. Schoenberg, M.D 2015-08-09 18:48:43 -04:00
parent e32543c31b
commit ade5b370bd
1 changed files with 6 additions and 2 deletions

View File

@ -26,8 +26,12 @@ static inline CGFloat AACStatusBarHeight(UIViewController *viewController)
{
return 0.f;
}
if (viewController.presentingViewController != nil)
{
// Modal views do not overlap the status bar, so no allowance need be made for it
UIView *view = viewController.view;
CGRect frame = [view.superview convertRect:view.frame toView:view.window];
BOOL viewOverlapsStatusBar = frame.origin.y < 20.f;
if (!viewOverlapsStatusBar) {
return 0.f;
}