即使应用程序以横向方式加载,iPad 上的所有视图也会以纵向模式启动
我有一组非常复杂的嵌套视图控制器,其中一个(大约 5 层深)具有在启动时生成的定制面板。我有代码可以检测设备的旋转并相应地重新排列面板,因此纵向有 3 个面板宽,横向有 4 个面板宽。我通过使用宽度组件而不是检测方向来完成此操作。
重新定位面板的方法(uiscrollview)在旋转甚至启动时都可以完美工作,但只能在启动时获取纵向高度。
无论我如何检索宽度属性,它都会返回纵向宽度项目,我已经尝试了以下操作:
float frameWidth = mainPanel.frame.size.width;
float frameWidth = self.view.frame.size.width;
float frameWidth = [[[UIApplication sharedApplication] keyWindow] frame].size.width;
但仍然没有运气!
(主面板是一个 uiscrollview,设置为自动拉伸到笔尖的大小)
这是更好的方法吗?
I have a nicely complex nested set of Viewcontrollers, one of them (about 5 deep) has custom made panel's that are generated on startup. I have code that detects the rotation of the device and re-arranges the panels accordingly so there's 3 panels wide on portrait and 4 panels wide on landscape. I have done this by using a width component rather than detecting the orientation.
The method that re-positions the panels (uiscrollview) works flawlessly on rotation and even on start up but only gets the portrait height on startup.
No matter how i retrieve the width attribute, its returning the portrait width item, i have tried the following:
float frameWidth = mainPanel.frame.size.width;
float frameWidth = self.view.frame.size.width;
float frameWidth = [[[UIApplication sharedApplication] keyWindow] frame].size.width;
and still no luck!
(mainpanel is a uiscrollview that is set to autostretch to the nib's size)
Is this a better way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论