I have an application with a UITabController , and each tab is a UINavigationController . The root of one of my UINavigationControllers is the UIViewController .
Inside this kind of controller controller, I want to break down some subspecies objects, but I'm confused as to where and how to lay them out in such a way that it will be resolution independent (i.e. not hardcode values ββlike 320px, 480px, 44px, etc.) .d.).
When the view is fully loaded and presented on a vertical iPhone, the height will be 367px = 480 - 20 (status bar) - 44 (navigation bar) - 49 (tab bar).
Inside the view controller, I am currently creating all of my routines in the viewDidLoad method. However, it seems that in this method the height of the current view is 460 pixels ( self.view.bounds.size.height ). Therefore, when setting up my routines, I cannot correctly calculate the size of anything.
In the viewWillAppear: method viewWillAppear: view knows its proper size, but that would mean setting up and calculating subview frames every time a view appears (for example, changing tabs or jumping out of a child view of controllers in the navigation stack.
This is the only way to do it right for the layout in viewWillAppear: :?
I tried using the autoresizesSubviews - autoresizingMask properties (parent autoresizesSubviews and autoresizingMask ), but they don't work at all !? Do they take effect only after all settings are configured and then changed (manual change / orientation?).
I would appreciate it if someone could tell me why automation does not work, and how best to lay out things due to the lack of hard coding of any size.
iphone cocoa-touch uikit uiview
Michael Waterfall Jan 10 2018-10-10 16:59
source share