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