Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class TableViewController: UITableViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Remember to use registerCell if you created a cell by code or XIB.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- }
- // MARK: - UITableViewDataSource
- override func numberOfSections(in tableView: UITableView) -> Int {
- return 1
- }
- override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return 5
- }
- override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: "default", for: indexPath)
- // Configure the cell...
- cell.textLabel?.text = "Section:\(indexPath.section), Row:\(indexPath.row)"
- cell.detailTextLabel?.text = "Detail to cell \(indexPath.row)"
- return cell
- }
- // MARK: - UITableViewDataSource
- override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- //Use to verify when a cell is select
- }
- }
Add Comment
Please, Sign In to add comment