diff --git a/Classes/IDMPhotoBrowser.m b/Classes/IDMPhotoBrowser.m index 125785fa..b6371bf2 100644 --- a/Classes/IDMPhotoBrowser.m +++ b/Classes/IDMPhotoBrowser.m @@ -191,7 +191,12 @@ - (id)init { _isdraggingPhoto = NO; _doneButtonRightInset = 20.f; - _doneButtonTopInset = 30.f; + if (@available(iOS 11.0, *)) { + // support iPhone X + _doneButtonTopInset = 30.f + self.view.safeAreaInsets.top; + } else { + _doneButtonTopInset = 30.f; + } _doneButtonSize = CGSizeMake(55.f, 26.f); if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) { @@ -1112,11 +1117,16 @@ - (BOOL)isLandscape:(UIInterfaceOrientation)orientation - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation { CGFloat height = 44; - + + // support iPhone X + if (@available(iOS 11.0, *)) { + height = 44 + self.view.safeAreaInsets.bottom; + } + if ([self isLandscape:orientation]) height = 32; - return CGRectMake(0, self.view.bounds.size.height - height, self.view.bounds.size.width, height); + return CGRectMake(0, self.view.bounds.size.height - height, self.view.bounds.size.width, 44); } - (CGRect)frameForDoneButtonAtOrientation:(UIInterfaceOrientation)orientation {