How iOS controllers are created

Source: Internet
Author: User

The creation of the iOS controller. In addition to the common Alloc init, there are ways to load storyboard and xib by loading the following:

1. Code ALLOC init Creation method

Viewcontroller *vc= [[Viewcontroller alloc] init];

2.storyboard Creating a Controller

1 "Loading the storyboard file developed

Uistoryboard *board = [Uistoryboard storyboardwithname:@ "Viewcon" bundle:nil];

Can be loaded into the developed Stroryboard file, but the storyboard file may contain multiple controllers, which will need to be specified

2 "Create the specified controller

Viewcontroller *VC = [Board instantiateviewcontrollerwithidentifier:@ "Viewcon"];

or directly create the controller that the arrow refers to

Viewcontroller *VC = [board Instantiateinitialviewcontroller];

3.xib Creating a Controller

Viewcontroller *VC = [[Viewcontroller alloc] initwithnibname:@ "Viewcon" bundle:nil];

The premise is that the class type of the Filesowner of the viewcon.xib must be viewcontroller, and the creation of the view or the drag control connection is complete.

Or you get the controller and set it directly through the code.

How iOS controllers are created

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.