[IOS] using Xib as the application portal with IDE

Source: Internet
Author: User

[IOS] using Xib as the application portal with IDE

In the article "Using Xib as an application entry with code" ", we describe how to use xib as an entry for an application by writing Code. However, in Xcode, the same functionality can be achieved through the tools provided by the IDE. This article explains how to use Xib as an entry for an application in the process of developing iOS apps, leaving a record for yourself and hoping to help developers in need. (The way the IDE works is a lot more complicated than using code.) However, in the process of operation, you can understand the operation and concept of the Xib file, suggesting that the developer follow the steps of the following article practice. )

Operation 1. Create a single View application

Use Xcode to create a new project and select the project type of single View application.

2. Removal of Storyboard

Remove storyboard and related files.

3. Establish Viewcontroller class

Establish the Mainviewcontroller class as the entrance. (Remember not to tick also create XIB file)

4. Establish Viewcontroller.xib

Set up Viewcontroller user interface Xib file, this way to choose window as a template for xib.

Drag a view into the Xib file, this view is the Viewcontroller user interface. (in the process of dragging, remember to avoid the screen on the editing area, to normal operation)

Drag a viewcontroller into the Xib file, and then define the Viewcontroller class to create the Viewcontroller class previously and remove the view content from the Viewcontroller preset. (in the process of dragging, remember to avoid the screen on the editing area, to normal operation)

Then the view and Viewcontroller in the Xib file are associated, and the view is injected into the Viewcontroller view property, allowing Viewcontroller to manipulate the user interface. (Drag the plus sign next to the view on the left window to the view object in the middle window to create an association)

Finally, the Viewcontroller and window in the associated xib file are injected into the Rootviewcontroller attribute of the window, and when the window is executed, the Viewcontroller Use Viewcontroller as the default user interface. (Drag the plus sign next to the left window Rootviewcontroller to the Viewcontroller object on the middle window to create an association)

5. Change Main Interface

Change the entry setting parameter for the application main interface The Mainviewcontroller.xib that was established for the previous step.

6. Implementation results

Compile and execute the sample project, you can see the iOS app, the correct use of Xib as the application portal.

[IOS] using Xib as the application portal with IDE

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.