robotmedia / RMGallery

A lightweight and modern gallery view for iOS 7.
Apache License 2.0
104 stars 23 forks source link

Setting initial gallery index does not work on iOS9 if presenting navigation controller navbar is not translucent #11

Open xjki opened 8 years ago

xjki commented 8 years ago

When presenting RMGalleryView on iOS9 from navigation controller if navigationController.navigationBar.translucent = NO, setting initial galleryIndex will fail (will display gallery with first image instead of image set by galleryIndex property).

On first call after [self setContentOffset:offset animated:animated]; first-call [RMGalleryView scrollViewDidScroll:] scrollView parameter returns correct contentOffset for scrollview so galleryIndex remains as intended.

On iOS9 on second [RMGalleryView scrollViewDidScroll:] call by iOS itself (view inset adjustments performed by navigation controller?) secon-call scrollView parameter has zero contextOffset which means it resets galleryIndex to first image. (On iOS8 these calls return correct contentOffset).