问题描述
所以我一直在研究iPad上的UIView问题。基本上我有一个splitview作为根视图,我想将我的自定义图像视图覆盖在splitview的顶部(这是因为splitview必须是根视图)。我遇到的问题是,当我在我的splitview上调用addSubview时,子视图会以默认方向显示,而不考虑iPad的当前方向。关于我做错了什么或者我没有设置标志的任何建议?
So I have been working on a problem with UIView on the iPad. Essentially I have a splitview as the root view and I want to overlay my custom image view over top of the splitview (This is because the splitview must be the root view). The problem that I have, is when I call addSubview on my splitview the subview gets displayed in its default orientation, with no regard to the iPad's current orientation. Any suggestions on what I am doing wrong or flag I am not setting?
谢谢!
我的代码我用来添加视图:
Code that I am using to add the view:
[splitViewController.view addSubview: myImageController.view];
屏幕截图示例:
推荐答案
因此,如果想出一个解决方案,那就是以编程方式创建视图并使用UIDevice的currentOrientation来正确调整视图的大小。
So if figured out a solution and that is to programmatically create the view and use UIDevice's currentOrientation to size the view properly.
这篇关于UIView添加了错误的方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!