diff --git a/RMGallery/RMGalleryView.m b/RMGallery/RMGalleryView.m index a97b2ca..0be6330 100644 --- a/RMGallery/RMGalleryView.m +++ b/RMGallery/RMGalleryView.m @@ -204,6 +204,9 @@ -(void)scrollViewWillEndDragging:(UIScrollView*)scrollView withVelocity:(CGPoint - (void)scrollViewDidScroll:(UIScrollView *)scrollView { + if (!self.scrollEnabled) { + return; + } const NSUInteger index = [_imageFlowLayout indexForOffset:scrollView.contentOffset]; if (index != _galleryIndex) { diff --git a/RMGallery/RMGalleryViewController.m b/RMGallery/RMGalleryViewController.m index a8bb934..b1b8a52 100644 --- a/RMGallery/RMGalleryViewController.m +++ b/RMGallery/RMGalleryViewController.m @@ -83,6 +83,17 @@ - (void)viewWillAppear:(BOOL)animated } } +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)orientation + duration:(NSTimeInterval)duration +{ + _galleryView.scrollEnabled = NO; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromOrientation +{ + _galleryView.scrollEnabled = YES; +} + - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];