diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m index 0de7faaab..d5cb82c7c 100644 --- a/Pod/Classes/MWPhotoBrowser.m +++ b/Pod/Classes/MWPhotoBrowser.m @@ -1004,16 +1004,22 @@ - (CGPoint)contentOffsetForPageAtIndex:(NSUInteger)index { - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation { CGFloat height = 44; - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && - UIInterfaceOrientationIsLandscape(orientation)) height = 32; - return CGRectIntegral(CGRectMake(0, self.view.bounds.size.height - height, self.view.bounds.size.width, height)); + if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape(orientation)) height = 32; + + CGFloat y = self.view.bounds.size.height - height; + if (@available(iOS 11.0, *)) y -= self.view.safeAreaInsets.bottom; + + return CGRectIntegral(CGRectMake(0, y, self.view.bounds.size.width, height)); } - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index { CGRect pageFrame = [self frameForPageAtIndex:index]; CGSize captionSize = [captionView sizeThatFits:CGSizeMake(pageFrame.size.width, 0)]; + CGFloat captionY = pageFrame.size.height - captionSize.height - (_toolbar.superview?_toolbar.frame.size.height:0); + if (@available(iOS 11.0, *)) captionY -= self.view.safeAreaInsets.bottom; + CGRect captionFrame = CGRectMake(pageFrame.origin.x, - pageFrame.size.height - captionSize.height - (_toolbar.superview?_toolbar.frame.size.height:0), + captionY, pageFrame.size.width, captionSize.height); return CGRectIntegral(captionFrame);