UIView not autoresizing correctly iPhone 3.5 inch vs 4 inch screen

匆匆过客 提交于 2019-12-07 12:17:59

问题


I have a UINavigationController that has as its top UIViewController a UIViewController with a UITabBar on it. (It is not a UITabBarController b/c I am told that Apple does not want you to push a UITabBarController on a UINavigationController).

The UITabBar controls 3 UIViewControllers. When I run it in the simulator, the 3 UIViewControllers work for the 3.5 inch screen, or the 4 inch screen depending on how I use the simulated metrics in Interface Builder. But I can not get the autoresizing to work on both the 3.5 and 4 inch screen. It seems like it's either or.

This should be very simple since it's just UIAutosizeRemaskFlexibileWidth and Height. I have tried this in code and also by playing with Interface builder, and the 3 UIViewControllers controlled by the UITabBar never fit the screen size. I should not have to write branching code for different iphone screen sizes should I?


回答1:


With iOS 6, struts and springs have been replaced by something called Autolayout.

I suggest you take a look at this link: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2



来源:https://stackoverflow.com/questions/12736977/uiview-not-autoresizing-correctly-iphone-3-5-inch-vs-4-inch-screen

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