为什么横向和纵向返回相同的帧尺寸?
我在 ViewDidLoad.I 纵向中打印视图的帧值,我得到的值是 frame rect is {{0, 20}, {768, 1004}}
,在横向中我得到的值是 frame矩形是 {{20, 0}, {748, 1024}}
。据我所知,帧值在纵向和横向模式下会互换,我的意思是宽度变为高度,反之亦然。可以有人告诉我问题是什么以及如何将框架分配给视图以避免方向问题。
提前致谢!
I am printing views's frame value in ViewDidLoad.I portrait I am getting value as frame rect is {{0, 20}, {768, 1004}}
and in Landscape I am getting as frame rect is {{20, 0}, {748, 1024}}
.where as I know frames values get interchanged in portrait and landscape mode I mean width becomes height and vice-versa.Can anyone tell me what is the problem and how I can allocate frame to views to avoid orientation problem.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,未设置 autoResizingMask,因此您在纵向和横向上会获得相同的矩形框。横向模式。设置视图的 autoresingmask 并检查 rect 中的更改。
By default autoResizingMask is no set,so you are getting the same rect frames on portrait & landscape mode. Set the autoresingmask for the view and check the changes in the rect.