iOS Custom View control calls the difference between system methods

Source: Internet
Author: User

1. Load: Load class to memory, call when program starts, call before main function (will be called only once)

2, Initialize: Initialize the class, the first time the class is used to call once (will only be called once)

3, Loadview: First determine whether the controller has a view, do not call the method, set the root view of the controller, after overriding the method, the main method, Xib, storyboard file will no longer work.

4. Initwithcoder: This method is called when the control is created from Xib, storyboard.

5, awakefromnib: Load xib Completion Call, this method is called after the Initwithcoder: method, the beginning of the Initwithcoder created by the control is dead, and then through the awakefromnib to wake up, So this will have a sequential sequence of calls: Viewwillappear-> initWithFrame, Viewdidload, Initwithcoder, awakefromnib

6. Viewdidload: View loading complete

7. Viewwillappear: View will appear

8, initWithFrame: When creating a control with a hand code, we typically add components & set some of its own properties in this method dynamically. This method is also called automatically by the internal system when the Init method is called.

4, Layoutsubviews: Convenient data calculation, generally we calculate the frame in this method, this method is the last time the control layout child control.

5, DrawRect: Convenient view redraw.

6. Initwithnibname: The class of xib to be loaded is the view controller class that we define. is a lazy load, the control on this view is nil and is not nil until it needs to be displayed.

7. Loadnibname: Instant loading, all elements in the Xib object loaded with this method already exist.

iOS Custom View control calls the difference between system methods

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.