Viewcontroller Life cycle Simple Induction

Source: Internet
Author: User

 One, call Order: 1. + (ID) alloc allocate memory; 2.-(ID) Init method (including other-(ID) init ... method), which is allowed to be called only once, and to be written with the Alloc method, the memory requested in the Init method is freed (or elsewhere) in the Dealloc method; 3. -(void) Awakefromnib This method is called after initialization with Xib, and this method is not generally overridden; 4. -(void) Loadview do not override this method if you are using Xib to create the Viewcontroller. This method is not generally modified; 5. -(void) Viewdidload view is called after the load is complete, this method is important to add some of your own defined controls, note that the frame of the view is not necessarily the frame at the time of display, the real frame will be in-(void) Viewdidappear: After. In the ios6.0+ version, it is only called once throughout the lifetime of the object, and it is important to note that the ios3.0~ ios5.x version may be repeated calls, when Viewcontroller received a memory warning, will release the view, and call Viewdidunload, and then re-call Viewdidload, so to support iOS6.0 Previous versions of children's shoes to pay attention to the memory management here. 6.-(void) Viewwillappear: (BOOL) Animated view is going to be displayed, you can load some pictures here, and some other memory-occupying resources; 7. -(void) Viewdidappear: (BOOL) When the animated view has been displayed; 8. -(void) Viewwilldisappear: (BOOL) When animated view is going to be hidden, you can release some of the larger memory-intensive resources before reloading in viewwillappear:. such as: Picture/sound/video. If the view is hidden and the resources in memory that are not called before the display are retained, then the chance of app Flash will increase, especially when the Viewcontroller is more than 9. -(void) Viewdidappear: (BOOL) When the animated view has been hidden; 10. -(void) Dealloc, do not call this method manually, this method is called automatically when the reference count value is 0. 

Viewcontroller Life cycle Simple Induction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.