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

在iphoneX展示图片有问题 #630

Open
kongxiaofeng opened this issue Dec 18, 2017 · 7 comments
Open

在iphoneX展示图片有问题 #630

kongxiaofeng opened this issue Dec 18, 2017 · 7 comments

Comments

@kongxiaofeng
Copy link

在iphoneX展示图片有问题 图片会放大 超过屏幕

@kongxiaofeng
Copy link
Author

iphone X 是这个样子的
simulator screen shot - iphone x - 2017-12-18 at 11 22 05

@kongxiaofeng
Copy link
Author

iphone 8 是这个样子的
simulator screen shot - iphone 8 - 2017-12-18 at 11 23 57

@kongxiaofeng
Copy link
Author

Iphone8 section figure on the iphone X display has a problem, how to settle this

@kongxiaofeng
Copy link
Author

@poprandi I hope to help a look

@foolsparadise
Copy link

这一块代码,在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

@wofl521WLF
Copy link

_zoomPhotosToFill = NO;
这个值设置为NO 即可处理此问题,默认的设置是YES,改为NO;
这个属性的意思是自适应大小。

@Kemenger
Copy link

Please issue in English

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants