SnapKit/Example-iOS/ListViewController.swift

45 lines
1.3 KiB
Swift
Raw Normal View History

2016-03-01 17:58:06 +08:00
//
// ViewController.swift
// Example-iOS
//
// Created by Spiros Gerokostas on 01/03/16.
// Copyright © 2016 SnapKit Team. All rights reserved.
//
import UIKit
import SnapKit
2016-03-01 18:14:50 +08:00
class ListViewController: UITableViewController {
2016-03-01 17:58:06 +08:00
2016-03-01 18:14:50 +08:00
let kCellIdentifier = "CellIdentifier"
let demos = ["Basic UIScrollView"]
2016-03-01 17:58:06 +08:00
override func viewDidLoad() {
super.viewDidLoad()
self.title = "SnapKit iOS Demos"
2016-03-01 18:14:50 +08:00
self.tableView?.registerClass(UITableViewCell.self, forCellReuseIdentifier: kCellIdentifier)
2016-03-01 17:58:06 +08:00
}
2016-03-01 18:14:50 +08:00
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(kCellIdentifier)! as UITableViewCell
cell.textLabel?.text = demos[indexPath.row]
return cell
}
2016-03-01 17:58:06 +08:00
2016-03-01 18:14:50 +08:00
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return demos.count
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
if indexPath.row == 0 {
let viewController = BasicUIScrollViewController()
navigationController?.pushViewController(viewController, animated: true)
}
}
2016-03-01 17:58:06 +08:00
}