Open cstm opened 6 years ago
这一块代码,在commit 66ddd73-on Apr 22, 2016基础上添加的,使用工程中的Library photos and videos一块,UI在iPhoneX上我这边试了下是OK了,其它建议类推。希望能帮到你。 Library photos and videos UI in this project , checked Run OK in iPhoneX , code based on commit 66ddd73-on Apr 22, 2016 , maybe help you
diff --git a/Pod/Classes/MWPhotoBrowser.m b/Pod/Classes/MWPhotoBrowser.m
index 0de7faa..80dcf8d 100644
--- a/Pod/Classes/MWPhotoBrowser.m
+++ b/Pod/Classes/MWPhotoBrowser.m
@@ -15,6 +15,12 @@
#define PADDING 10
+#define IOS11_OR_LATER_SPACE(par) ({ float space = 0.0; if ([[UIDevice currentDevice] systemVersion].floatValue>=11) { space = par; } (space); })
+#define JF_KEY_WINDOW [UIApplication sharedApplication].keyWindow
+#define JF_TOP_SPACE IOS11_OR_LATER_SPACE(JF_KEY_WINDOW.safeAreaInsets.top)
+#define JF_TOP_ACTIVE_SPACE IOS11_OR_LATER_SPACE(MAX(0, JF_KEY_WINDOW.safeAreaInsets.top-20))
+#define JF_BOTTOM_SPACE IOS11_OR_LATER_SPACE(JF_KEY_WINDOW.safeAreaInsets.bottom)
+
static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
@implementation MWPhotoBrowser
@@ -161,6 +167,9 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
// Toolbar
_toolbar = [[UIToolbar alloc] initWithFrame:[self frameForToolbarAtOrientation:self.interfaceOrientation]];
+ CGRect frame = _toolbar.frame;
+ frame.origin.y = self.view.bounds.size.height - frame.size.height - JF_BOTTOM_SPACE;
+ _toolbar.frame = frame;
_toolbar.tintColor = [UIColor whiteColor];
_toolbar.barTintColor = nil;
[_toolbar setBackgroundImage:nil forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
@@ -283,6 +292,9 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
[_toolbar removeFromSuperview];
} else {
[self.view addSubview:_toolbar];
+ CGRect frame = _toolbar.frame;
+ frame.origin.y = self.view.bounds.size.height - frame.size.height - JF_BOTTOM_SPACE;
+ _toolbar.frame = frame;
}
// Update nav
@@ -495,7 +507,9 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
// Toolbar
_toolbar.frame = [self frameForToolbarAtOrientation:self.interfaceOrientation];
-
+ CGRect frame = _toolbar.frame;
+ frame.origin.y = self.view.bounds.size.height - frame.size.height - JF_BOTTOM_SPACE;
+ _toolbar.frame = frame;
// Remember index
NSUInteger indexPriorToLayout = _currentPageIndex;
@@ -1438,7 +1452,9 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
// Toolbar
_toolbar.frame = CGRectOffset([self frameForToolbarAtOrientation:self.interfaceOrientation], 0, animatonOffset);
-
+ CGRect frame = _toolbar.frame;
+ frame.origin.y = self.view.bounds.size.height - frame.size.height - JF_BOTTOM_SPACE;
+ _toolbar.frame = frame;
// Captions
for (MWZoomingScrollView *page in _visiblePages) {
if (page.captionView) {
@@ -1461,6 +1477,9 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
// Toolbar
_toolbar.frame = [self frameForToolbarAtOrientation:self.interfaceOrientation];
if (hidden) _toolbar.frame = CGRectOffset(_toolbar.frame, 0, animatonOffset);
+ CGRect frame = _toolbar.frame;
+ frame.origin.y = self.view.bounds.size.height - frame.size.height - JF_BOTTOM_SPACE;
+ _toolbar.frame = frame;
_toolbar.alpha = alpha;
// Captions
this will not fix the issue. We you rotate an image for exemple 5/50, i will show an other image like 12/50
When i try to rotate on an image, it shows up a new image It seems to happen only on iPhone X Is there any workaround for this ?