iOS Foundation-uikit Framework-Multiple controller management-creation of controller and controller view

Source: Internet
Author: User

Master


One, the controller's various creation way
How to create a controller

Create with Storyboard

Note: Loading Uistoryboard simply loads the storyboard named Test, and does not create
Controllers and controls in the storyboard

Create with Xib
Note: In order for the view in Xib to be set to the view of the created controller, you must set the file ' s owner of Xib
The controller is created for. and file's owner right-click on the view to connect to the view in Xib.
Storyboard The above actions are done by default

Second, how to create the Controller view
1. Create without the same name Xib case
2. Create with Storyboard
3. Create with the specified Xib case
4. Create with the same name Xib case
5. Create a case with the same name without controll
6. Overriding the controller's Loadview method

First approach: Create without xib and storyboard cases
(Creating a controller from Alloc init automatically creates a blank view as the controller's view)

Second way: Create with Storyboard
If created through storyboard, it is based on the controller view described by the arrow pointing to the storyboard
Create a view of the controller

Third Way: Create with specified Xib (call Initwithnib: method to create Controller)
If created through Xib, the controller's view is created according to the controller view described in Xib


Fourth Way: Created with the same name as the controller xib (directly call the Init method to create the controller)
If you have the same name Xib, the view that is described in the same name Xib is automatically found as the controller

Fifth approach: Created with the same name as the controller (but without controller) Xib (call directly
Init method to create a controller)
If there is a xib with the same name as the controller (but without controller), the view of the xib is automatically found as the control
View of the system

Sixth way: Override the Loadview method of the controller (this method is typically used for custom controller view)
When to call Loadview will represent when the controller's view is loaded
If you override the controller's Loadview method, you will not be able to load a xib that has the same name removed controller
With the same name as the Xib, instead of creating a blank view (without writing anything) as a view of the controller,
You can also create a view directly in the Loadview

Third, the Controller view delay loading (lazy loading)
* The view of the controller is delayed loading: reload when used
* You can use the Isviewloaded method to determine whether a Uiviewcontroller view has been loaded
* The controller's view is loaded and will call Viewdidload

iOS Foundation-uikit Framework-Multiple controller management-creation of controller and controller view

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.