Created
January 28, 2015 23:40
-
-
Save chug2k/b6f6f59317c623efadeb to your computer and use it in GitHub Desktop.
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
// Simplest possible TableView. | |
import Foundation | |
class SimpleTableViewController: UITableViewController { | |
let data = ["foo", "bar", "baz"] | |
let CellIdentifier = "CellIdentifier" | |
override func viewDidLoad() { | |
self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier:CellIdentifier) | |
} | |
// UI TableView. | |
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return data.count | |
} | |
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { | |
var cell:UITableViewCell = self.tableView.dequeueReusableCellWithIdentifier(CellIdentifier) as UITableViewCell | |
cell.textLabel?.text = data[indexPath.row] | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment