-
Notifications
You must be signed in to change notification settings - Fork 0
App Segue
App - Segue
An app with a TableView and when you tap any elements within that TableView it switches over to a different view and also provides that new view with the detail of which cell from the table you tapped on.
Created a Swift class to manage the new View Controller and then used “willSelectRowAtIndexPath” to pass on the information about which row has been tapped to your new ViewController.
Start with the Main.storyboard Shrink the ViewController so that you can fit the TableViewController below it. Drag the TableViewController below the ViewController. Click on Table View under TableViewController Open the right window Click the 4th icon Change the Content to “Static Cells” There will be 3 rows For row 1: Click on each Table View Cell Open the right window Click the 4th icon Change the Style to “Basic” On the cell, change the default “Title” to “Row 0” For row 2: Click on each Table View Cell Open the right window Click the 4th icon Change the Style to “Basic” On the cell, change the default “Title” to “Row 1” For row 3: Click on each Table View Cell Open the right window Click the 4th icon Change the Style to “Basic” On the cell, change the default “Title” to “Row 2”
Add a button to ViewController Press Control button and drag from the button to the TableViewController and choose “show”
We’ll need to create a TableViewController.swift Click on File —> new File Go to iOS —> Source —> Cocoa Touch Class For Class, type “TableViewController” For Subclass, type “UITableViewController”
Now we need to link the two up. How to tell Xcode that TableViewController.swift is going to control the TableViewController: Click on the TableViewControll Open the right window Click on the 3rd icon to create a Custom Class For Class, choose “TableViewController"