【发布时间】:2012-11-05 09:09:37
【问题描述】:
无论方向如何,主屏幕和 self.view 始终保持相同的宽度和高度尺寸背后的逻辑是什么(即使 self.view 确实重新调整大小以适合当前设备方向),而self.view 的 sub-View 在设备方向改变时返回修改后的宽高尺寸?
NSLog(@"screen bounds w: %f, h: %f", [[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height );
NSLog(@"self.view frame w: %f, h: %f", self.view.frame.size.width, self.view.frame.size.height );
NSLog(@"myView frame w: %f, h: %f", _myView.frame.size.width, _myView.frame.size.height );
日志输出纵向
2012-11-05 16:15:11.152 test[2807:11303] screen bounds w: 320.000000, h: 480.000000
2012-11-05 16:15:11.153 test[2807:11303] self.view frame w: 320.000000, h: 460.000000
2012-11-05 16:15:11.153 test[2807:11303] myView frame w: 320.000000, h: 460.000000
日志输出景观
2012-11-05 16:14:38.800 test[2807:11303] screen bounds w: 320.000000, h: 480.000000
2012-11-05 16:14:38.801 test[2807:11303] self.view frame w: 300.000000, h: 480.000000
2012-11-05 16:14:38.801 test[2807:11303] myView frame w: 480.000000, h: 300.000000
【问题讨论】:
标签: objective-c ios xcode views dimensions