【问题标题】:NIPhotoAlbumScrollView: unable to adjust image after device rotationNIPhotoAlbumScrollView:设备旋转后无法调整图像
【发布时间】:2012-02-11 18:22:32
【问题描述】:

我正在使用来自Nimbus frameworkNIPhotoAlbumScrollView 一旦我旋转设备,显示的图像就会失去其中心位置......有人使用过这个组件并面临同样的情况吗?

ps:我正在为 NIPhotoAlbumScrollView 及其 NIPagingScrollViewPage

使用 (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight) 掩码

【问题讨论】:

    标签: iphone objective-c ios nimbus-ios


    【解决方案1】:

    在相应的视图控制器方法中调用 NIPhotoAlbumScrollView 的这些方法

    - willRotateToInterfaceOrientation:duration:
    - willAnimateRotationToInterfaceOrientation:duration:
    

    这样

    - (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];
    }
    

    文档http://latest.docs.nimbuskit.info/interface_n_i_paging_scroll_view.html#a3cd8024a82d09f24019ea916551904c4

    【讨论】:

    • 我不明白这如何解决问题......我应该用那种方法做什么? (无论如何我在轮换后通过调用“reloadData”暂时解决了......但我知道这不是最好的解决方案)
    • 这些方法准备您的相册视图以进行旋转。在我的 UIViewController 子类中调用它们为我解决了这个问题。
    猜你喜欢
    • 2019-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-19
    • 1970-01-01
    相关资源
    最近更新 更多