Mention Uiviewcontrol, everyone is not strange! In the actual development of the day, the actual development should be indispensable to it. Learn Android Pro, also on the life cycle of these four words are not unfamiliar, whether it is activity, or service, have been familiar with it. Also because of the previous experience of Android, see after the first feeling is, its life cycle is what? Well, having said so much, start entering Uiviewcontrol's body.
opened the official website, looked for the next, and did not see its life cycle of the exposition, but some is about the various Viewcontrol introduction. But from its class of methods, we can see some end assumption, but whether or not, or write down the code under test as well. The specific code is not listed, and the life cycle is recorded. For example, the whole process is as follows, the specific method is: initwithnibname this is the controller's initialization method, when you use the nib file initialization, will be automatically executed directly, You can also customize nib file initialization. And when you don't use the nib file, Nibname will be nil, but you can still return an empty UIView, and you can customize your own view. loadview with code to create a view for the controller, But when you need code to customize the view, the custom UI will be written in this method. It is important to note that this method does not use the Super view viewdidload can do some loadview after the operation, of course, this method and the above Loadview method before the Viewcontroller die is executed only once. Similar to the Android OnCreate bar viewwillappear and viewdidappear are both put together because both of these are executed whenever the view is to appear, The viewwillappear is executed when the view is not yet visible, and when view is added to the view, this method is executed to indicate that the control view is loaded. viewwilldisappear and viewdiddisappear are two that are executed when the view disappears and will be called viewwilldisappear when it disappears. Immediately after disappearing, call Viewdiddisappear viewwillunload and viewdidunload , which correspond to the above Loadview and Viewdidload, when the memory warning is received, In Viewwillunload, we can save some of the necessary information in the change view, which is guaranteed to be released when the view is not visible. In the Viewdidunload method, we can release those strong references. Related article: http://www.2cto.com/kf/201307/226133.html