iPhone应用程序处于横向模式,但视图的边界仍然是纵向

Boo*_*oon 6 iphone uikit

当您将手机的方向设置为横向模式时,幕后真的会发生什么?当我追踪主屏幕的边界和任何子视图的边界时,宽度和高度仍然是320x480,而不是480x320.

知道为什么吗?

Boo*_*oon 0

发现问题 - 旋转后边界仍然相同的原因是因为旋转后唯一受影响的是视图的变换属性。

快速跟踪视图的变换可以得出以下结果:

2012-01-31 12:19:02.114 TestScollviewRotation[9834:207] orientation: UIDeviceOrientationPortrait
2012-01-31 12:19:02.116 TestScollviewRotation[9834:207] 0.000000 -1.000000 1.000000 0.000000

2012-01-31 12:21:41.898 TestScollviewRotation[9834:207] orientation: UIDeviceOrientationPortraitUpsideDown
2012-01-31 12:21:41.898 TestScollviewRotation[9834:207] 0.000000 1.000000 -1.000000 0.000000

2012-01-31 12:21:58.780 TestScollviewRotation[9834:207] orientation: UIDeviceOrientationLandscapeRight
2012-01-31 12:21:58.780 TestScollviewRotation[9834:207] 1.000000 0.000000 -0.000000 1.000000

2012-01-31 12:19:03.181 TestScollviewRotation[9834:207] orientation: UIDeviceOrientationLandscapeLeft
2012-01-31 12:19:03.181 TestScollviewRotation[9834:207] 1.000000 0.000000 -0.000000 1.000000
Run Code Online (Sandbox Code Playgroud)