NIPhotoAlbumScrollView: unable to adjust image after device rotation
-
28-04-2021 - |
문제
I'm using NIPhotoAlbumScrollView from Nimbus framework and once I rotate the device the image displayed loses its central position... have someone used this component and faced my same situation?
ps: I'm using (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) mask for both NIPhotoAlbumScrollView and its NIPagingScrollViewPage
해결책
Call these methods of your NIPhotoAlbumScrollView in corresponding view controller methods
- willRotateToInterfaceOrientation:duration:
- willAnimateRotationToInterfaceOrientation:duration:
Like this
- (BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation { return YES; }
//====================================================================================================
- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) toInterfaceOrientation duration: (NSTimeInterval) duration
{
[super willRotateToInterfaceOrientation: toInterfaceOrientation duration: duration];
[self.photoAlbumView willRotateToInterfaceOrientation: toInterfaceOrientation duration: duration];
}
//====================================================================================================
- (void) willAnimateRotationToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation
duration: (NSTimeInterval) duration
{
[super willAnimateRotationToInterfaceOrientation: interfaceOrientation duration: duration];
[self.photoAlbumView willAnimateRotationToInterfaceOrientation: interfaceOrientation duration: duration];
}
제휴하지 않습니다 StackOverflow