Created
October 19, 2014 21:24
-
-
Save toast38coza/8e6ac406cd50e45765b5 to your computer and use it in GitHub Desktop.
Show a list of items in a tableview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drag | |
// Add UITableViewDelegate delegage | |
// class ViewController: UIViewController, UITableViewDelegate { | |
let people = ["Jim", "Joe", "Bob", "Jane"] | |
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return people.count | |
} | |
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
let cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: "cell") | |
cell.textLabel?.text = people[indexPath.row] | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment