Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for SafeAreas on iPhone X #643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Pod/Classes/MWPhotoBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down