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

iOS 11 display multiple images swipe issue #620

Open
sandeepsuthar opened this issue Oct 24, 2017 · 9 comments
Open

iOS 11 display multiple images swipe issue #620

sandeepsuthar opened this issue Oct 24, 2017 · 9 comments

Comments

@sandeepsuthar
Copy link

When i use this library for iOS 11 and display multiple images from array then swipe one by one. When 0th index image swipe for next image to display then 1st and 2nd image both show at same time. Below iOS 11 all works well but on iOS 11 it show two images on full screen preview.

@poprandi
Copy link

I have the same problem with iOS 11.
@sandeepsuthar Have you found a solution?

@sandeepsuthar
Copy link
Author

sandeepsuthar commented Oct 26, 2017

i found that without caption view everything works fine but with caption this library show two pages at same time.
@poprandi

@poprandi
Copy link

It looks like that in iOS 11 the removeFromSuperview function will call every time viewWillLayoutSubviews. I changed viewWillAppear and viewWillLayoutSubviews for iOS 11:

- (void)viewWillAppear:(BOOL)animated {
    
    // Super
    [super viewWillAppear:animated];
    
    // Status bar
    if (!_viewHasAppearedInitially) {
        _leaveStatusBarAlone = [self presentingViewControllerPrefersStatusBarHidden];
        // Check if status bar is hidden on first appear, and if so then ignore it
        if (CGRectEqualToRect([[UIApplication sharedApplication] statusBarFrame], CGRectZero)) {
            _leaveStatusBarAlone = YES;
        }
    }
    // Set style
    if (!_leaveStatusBarAlone && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
        _previousStatusBarStyle = [[UIApplication sharedApplication] statusBarStyle];
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:animated];
    }
    
    // Navigation bar appearance
    if (!_viewIsActive && [self.navigationController.viewControllers objectAtIndex:0] != self) {
        [self storePreviousNavBarAppearance];
    }
    [self setNavBarAppearance:animated];
    
    // Update UI
	[self hideControlsAfterDelay];
    
    // Initial appearance
    if (!_viewHasAppearedInitially) {
        if (_startOnGrid) {
            [self showGrid:NO];
        }
    }
    
    // If rotation occured while we're presenting a modal
    // and the index changed, make sure we show the right one now
    if (_currentPageIndex != _pageIndexBeforeRotation) {
        [self jumpToPageAtIndex:_pageIndexBeforeRotation animated:NO];
    }
    
    // Layout
    if (@available(iOS 11.0, *)) {
        [self layoutVisiblePages];
    }
    [self.view setNeedsLayout];
}
- (void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];
    
    if (@available(iOS 11.0, *)) {
        // do nothing
    } else {
        [self layoutVisiblePages];
    }
}

@sandeepsuthar

@sandeepsuthar
Copy link
Author

sandeepsuthar commented Oct 26, 2017

Thank you so much for your valuable and quick response. You saved my hours but what's wrong with iOS 11?
Thank you again @poprandi

@sandeepsuthar
Copy link
Author

@poprandi When we delete any image then scrollview show black shadow with your logic. Rest working fine on iOS 11.
How can i solve this?

@sandeepsuthar
Copy link
Author

@poprandi Black shadow with image delete issue has been solved but when zoom photo bigger then screen size and then single click on it.
Top bar and Bottom bar will toggle then suddenly image zoom shifted downward/upward slightly.
how to overcome this problem in iOS 11?

respan added a commit to drommobile/MWPhotoBrowser that referenced this issue Oct 31, 2017
@yakubbaev
Copy link

Fixed another iOS 11 issue in #622

pagrit added a commit to willhaben/MWPhotoBrowser that referenced this issue Nov 15, 2017
@toutoumu
Copy link

It looks like that in iOS 11 the removeFromSuperview addSubview function will call every time viewWillLayoutSubviews.
在self.view中添加View(addSubview)或者移除View(removeFromSuperview)都会触发viewWillLayoutSubviews方法,我的做法是判断当前_gridController == nil 如果_gridController == nil 那么设置 _pagingScrollView 显示在可见范围,否则显示在不可见范围,修改方法 layoutVisiblePages
将下面这几行替换

// Get paging scroll view frame to determine if anything needs changing
 CGRect pagingScrollViewFrame = [self frameForPagingScrollView];
 // Frame needs changing
 if (!_skipNextPagingScrollViewPositioning) {
     _pagingScrollView.frame = pagingScrollViewFrame;
 }
 _skipNextPagingScrollViewPositioning = NO;

替换为

if (_gridController) {
        CGRect newPagingFrame = [self frameForPagingScrollView];
        newPagingFrame = CGRectOffset(newPagingFrame, 0, (self.startOnGrid ? 1 : -1) * newPagingFrame.size.height);
        _pagingScrollView.frame = newPagingFrame;
    } else {
        // Get paging scroll view frame to determine if anything needs changing
        CGRect pagingScrollViewFrame = [self frameForPagingScrollView];
        _pagingScrollView.frame = pagingScrollViewFrame;
    }

@sandeepsuthar
Copy link
Author

when i zoom the image and then toggle the top and bottom bar then zoom also shifted slightly .
how to solve this? @toutoumu @yakubbaev

fixique pushed a commit to surfstudio/MWPhotoBrowser that referenced this issue Dec 26, 2017
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