From 6e42785b8672b1dedb6c71819c0a4910fcdfa872 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 3 Dec 2017 17:35:57 +1100 Subject: [PATCH] Fix toolbar position for pre-iOS 11 devices --- Classes/IDMPhotoBrowser.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Classes/IDMPhotoBrowser.m b/Classes/IDMPhotoBrowser.m index 6ab314ed..8549f3a4 100644 --- a/Classes/IDMPhotoBrowser.m +++ b/Classes/IDMPhotoBrowser.m @@ -488,7 +488,7 @@ - (CGRect)animationFrameForImage:(UIImage *)image presenting:(BOOL)presenting sc if (@available(iOS 11.0, *)) { // use the windows safe area inset UIWindow *window = [UIApplication sharedApplication].keyWindow; - UIEdgeInsets insets = UIEdgeInsetsZero; + UIEdgeInsets insets = UIEdgeInsetsMake(_statusBarHeight, 0, 0, 0); if (window != NULL) { insets = window.safeAreaInsets; } @@ -1159,7 +1159,8 @@ - (CGRect)adjustForSafeArea:(CGRect)rect adjustForStatusBar:(BOOL)adjust { if (@available(iOS 11.0, *)) { return [self adjustForSafeArea:rect adjustForStatusBar:adjust forInsets:self.view.safeAreaInsets]; } - return rect; + UIEdgeInsets insets = UIEdgeInsetsMake(_statusBarHeight, 0, 0, 0); + return [self adjustForSafeArea:rect adjustForStatusBar:adjust forInsets:insets]; } - (CGRect)adjustForSafeArea:(CGRect)rect adjustForStatusBar:(BOOL)adjust forInsets:(UIEdgeInsets) insets {