Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/116.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
试图解决iOS中的轮换问题_Ios_Uiview_Uiscrollview_Rotation - Fatal编程技术网

试图解决iOS中的轮换问题

试图解决iOS中的轮换问题,ios,uiview,uiscrollview,rotation,Ios,Uiview,Uiscrollview,Rotation,我在修复iPad应用程序的问题时遇到了问题 按下主视图控制器上的按钮时,我正在加载照片视图控制器 在纵向模式下,视图控制器加载良好,但在横向模式下加载时,我的图片看起来错误: 我希望它看起来像: 我已将问题缩小到以下电话: - (CGRect)frameForPageAtIndex:(NSUInteger)index { CGRect bounds = pagingScrollView.bounds; CGRect pageFrame = bounds; pageFr

我在修复iPad应用程序的问题时遇到了问题

按下主视图控制器上的按钮时,我正在加载照片视图控制器

在纵向模式下,视图控制器加载良好,但在横向模式下加载时,我的图片看起来错误:

我希望它看起来像:

我已将问题缩小到以下电话:

- (CGRect)frameForPageAtIndex:(NSUInteger)index {
    CGRect bounds = pagingScrollView.bounds;
    CGRect pageFrame = bounds;
    pageFrame.size.width -= (2 * PADDING);
    pageFrame.origin.x = (bounds.size.width * index) + PADDING;
    return pageFrame;
}
我一直在尝试从
pagingScrollView.bounds
切换到
pagingScrollView.frame
,但没有成功<代码>分页CrollView.bounds是我的视图的子视图。我只是不知道怎样才能让它识别方向


注意:当我旋转设备时,问题会自行解决。

您需要为视图的
autosizingMask
属性设置适当的值

如果您使用的是xib文件,请在interface builder中使用大小检查器(XCode 4.2中“实用程序”面板上最右边的第二个选项卡)