Ios-viewdidload, Viewwilldisappear, viewwillappear difference and loading order

Source: Internet
Author: User

Viewwillappear:

Called when the view was about to made visible. Called when the Default does nothing view is about to be visible. No action is taken by default

Viewdidappear:

Called when the view had been fully transitioned onto the screen. The Default does nothing view has been completely transitioned to the screen when called

Viewwilldisappear:

Called when the view is dismissed, covered or otherwise hidden. The Default does nothing view is dismissed when called, overwritten, or otherwise hidden. No action is taken by default

Viewdiddisappear:

Called after the view is dismissed, covered or otherwise hidden. The Default does nothing view is dismissed after it is called, overwritten, or otherwise hidden. By default, no action is performed loadview; This is where subclasses should create their custom view hierarchy if they aren ' t using a nib. Should never be called directly. This is when they are not using the NIB View page, the subclass will create its own custom view layer. Must not be called directly.

Viewdidload; Called after the view has been loaded. For view controllers created in code, this is After-loadview. For view controllers unarchived from a nib, which is after the view is set.

Called after the view is loaded, if the view loader is created in code, he will be called after the Loadview method, and if it is output from the nib View page, it will be called after the view has been set up.

"initwithnibname:bundle:" loads the nib file to initialize the "loadview" load view "viewdidload" The method that is called when the view is loaded into memory "viewdidunload" the method that will be called when the view is released from memory ( Called when the memory is too low to free some unwanted views)

"viewwillappear" method to call when a view is received in the window will be visible

"viewdidappear" method to call when a view is received when the window is already visible

"viewwilldisappear" the method to call when a notification is received that the view will be stripped, overwritten, or hidden in the window

"viewdiddisappear" a method that notifies a call when a view has been removed, overwritten, or hidden in a window

"didreceivememorywarning" the method that will be executed after receiving a memory warning notification from the system

Whether "shouldautorotatetointerfaceorientation" supports rotated views in different directions

"willanimaterotationtointerfaceorientation" the method that will be executed before the view is rotated (used to adjust the rotation view)

When a view controller is created and displayed on the screen. Order of execution of code

1, Alloc create objects, allocate space

2. Init (Initwithnibname) initializes the object, initializes the data

3, Loadview from the nib load view, usually this step does not need to interfere. Unless you're not using the Xib file to create a view

4, Viewdidload loading complete, can be customized data and dynamic creation of other controls

5, Viewwillappear View will appear before the screen, the view will be displayed on the screen immediately

6, Viewdidappear view has been rendered on the screen completed

When a view is removed from the screen and the execution order is destroyed, the order is almost the opposite of the above

1. Viewwilldisappear view will be removed from the screen before execution

2, Viewdiddisappear view has been removed from the screen, the user can not see this view

3. Dealloc view is destroyed, you need to release the objects you created in Init and viewdidload

Ios-viewdidload, Viewwilldisappear, viewwillappear difference and loading order

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.