UIView added with incorrect orientation

时光总嘲笑我的痴心妄想 提交于 2020-01-05 09:31:49

问题


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?

Thanks!

Code that I am using to add the view:

[splitViewController.view addSubview: myImageController.view];

Example screenshots: http://www.engineering.uiowa.edu/~krtaylor/so/


回答1:


So if figured out a solution and that is to programmatically create the view and use UIDevice's currentOrientation to size the view properly.




回答2:


I had the same problem, seams resolved by removing from the parent view the "autoresize subview" option in IB.
Select the view a then: Inspector -> Attributes (first tab) -> drawing.



来源:https://stackoverflow.com/questions/2656088/uiview-added-with-incorrect-orientation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!