How does iOS determine to apply the autoresizing masks if launched on iPad?
I do not know how to explain my question properly, but if anyone understand it i开发者_StackOverflow中文版s much appreciated else this question can be deleted.
I am making an universal application I wonder: The code I write in loadView
I write positions of components specified in a iPhone points (320, 480). And from the documentation below it says that autoresizing is a response to their superview being moved or resized. So my question is how does the code/views know to autoresize when runned on a iPad? Because, are the superview (which is self.view) really resized?
Code you write outside of loadView and attaches to self.view and with iPhone positions (320, 480) are not automatically resized even though you use autoresizing masks.
I know this is for Mac OSX but: (Quote from Mac OSX Documentation)
Autoresizing of Subviews NSView provides a mechanism for automatically moving and resizing subviews in response to their superview being moved or resized. In many cases simply configuring the autoresizing mask for a view provides the appropriate behavior for an application. Autoresizing is on by default for views created programmatically, but you can turn it off using the setAutoresizesSubviews: method.
When your UIViewController is presented modally or is pushed onto a UINavigationController, UITabBarController, or the like, its root view will be resized to fit the appropriate content area. Any subviews are resized according to their autoresizing masks.
Your code "outside of loadView" actually will be resized automatically, but (depending on exactly when this code is executed) the root view may have already been resized: it's the difference between adding a 320-px width view into a 320-px superview and then resizing to 1024 px versus adding a 320-px width view into a superview that is already 1024 px.
精彩评论