Using the Swift development--storyboard tutorial

Source: Internet
Author: User

If the app includes many different pages, using storyboard can help you reduce the glue code that allows you to jump between pages. Past developers have created interface design files (i.e. "nib" or "xib" files) for each view controller, and now, as long as a single storyboard, can take over the interface design of all view controllers and their association.

Storyboard has many advantages:

  • Use storyboard to better understand all the views in the app and the profile of the associations between them. It's easier to take control of the whole world, because all the designs are contained in a single file, not scattered in a number of individual nib files.

  • Storyboard can describe transitions between different views, which are called "segue" (meaning "transitions", while "Storyboard" is intended to be "split mirror", both from movie terminology), You can create transitions directly in storyboard by connecting different view controllers. Thanks to the transition, the code for the interface is less than it used to be.

  • Storyboard makes it easier to work with table views by using the New prototype table entry (prototype cell) and static table entry (the Statics cell) feature. The design of the table view can be done almost entirely in the storyboard editor, which also reduces the amount of code.

  • Storyboard makes auto layout easier to use. The automatic layout feature allows you to determine the location and size of elements by defining mathematical relationships between interface elements, greatly simplifying the adaptation of screens of different sizes. Automatic layout is not within the scope of this tutorial, for more information, see Getting started with automatic layouts .

If you hate interface Builder very much, or if you're advocating code for all the interfaces, storyboard might not be for you. Personal assertion is that the code can write less, especially the UI code, so storyboard is simply a weapon for me to prepare.

If you want to continue using nib, keep using it, knowing that you can use nib in storyboard, and that the two are not mutually exclusive.

1. Open Xcode, create a new project, language select Swift.

2, file Inspector (File Checker)

3, main.storyboard Delete the original view controller.

4 . Drag a Tab-bar controller (the page bar control) from the object library to the panel. Click on an empty area to zoom in to zoom out view.

5, run. You will find an error at this time.

failed to instantiate the default view controller for Uimainstoryboardfile ' Main '-perhap s the designated entry point was not set?

No entrance is set, that is, the initial view controller was not set after deleting the first used scene. To resolve the problem, select the page bar controller, and then in   attributes Inspector (property Inspector)   selected   is Initial View Controller  .

6, run OK again."


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Using the Swift development--storyboard tutorial

Related Article

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.