ios-View life cycle

Source: Internet
Author: User

We can divide a view into 4 basic states: View creation, view visibility, view not visible, system low memory.

1. When the view is being created, the Viewdidload method is called, this time the view is not present, but the view controller is initialized and just loaded into memory, which is often used to initialize the view controller, such as controls commonly used in the initialization view.

2. The Viewvillappear and Viewdidappear methods are called separately before and after the view is visible.

3. The Viewvilldisappear and Viewdidappear methods are called respectively before and after the view is not visible.

4. In the case of low application system memory, the Didreceivememorywarning and Viewdidunload methods are called. Note: After IOS6, the Viewdidunload method is no longer applicable. Instead of just supporting the Didreceivememorywarning method, its main task is to free up memory, including the release of member variables and the release of views.

Of the seven methods mentioned above, except that the Viewdidload method can only be called once, other methods are called multiple times.

The actual development will perform your own task according to each different life cycle node.

ios-View life cycle

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.