[Rookie growth Kee]ios Development Self-study note 06-Navigation controller and Segue transfer data

Source: Internet
Author: User

Navigation controllers are typically used to display hierarchical content of the down navigation interface, limited by the size of the device screen, the iphone or ipad needs more hierarchical access to display enough content, the navigation controller and the table view is generally present, but not necessarily bound to use together, The table view is embedded in the navigation controller for hierarchical display of view content, a single view application for the template to create a project, open Main.storyboard, click View Controller then click on the editor->embed in->navigation controller on the toolbar to embed the view controllers in the navigation controller, as its rootviewcontroller, That is, the view controller acts as the root view of the navigation controller after the program is opened, at the top level of the navigation controller hierarchy. Add a table view to the view controller, set the number of prototype cells to 1, and then drag a view controller into the Main.storyboard. Hold down the CONTROL key and click the prototype cell of Table view to drag to the newly added view controller, then release the mouse and select push, such as:

Results after running the program:

The table cell row clicks into the next layer of the navigation controller to display the contents of the label on the previous layer table in the middle of the view controller on the next layer.

First, define a subclass of view controller for the newly added view controller because a Uilabel object is added to the prototype cell, so you need to define a "custom" corresponding to this The UITableViewCell subclass of the table cell.

Here are a few details to note:

    • Click on the previously claimed segue to define a unique identifier name, which is used as a unique identifier in the later program to select Segue.
    • To define a Iboutlet variable for the UITableView object in the View controller
    • You must establish a transition variable in the bottom-level view of the custom to hold the value passed by the segue, not directly assigned to the Uilabel text

Last generated program effect:

[Rookie growth Kee]ios Development Self-study note 06-Navigation controller and Segue transfer data

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.