the cell is very simple, just a textLabel. i want to tap the cell and then print some words. this is a test . but the didSelectRowAtIndexPath is not work. Please tell me why, thank you !
import UIKit
import SnapKit
class ListTableViewController : UITableViewController{
var itemData: ListTableModel!
var header: UIView!
override init(style: UITableViewStyle){
super.init(style: style)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
itemData = ListTableModel()
self.tableView.dataSource = self
self.tableView.delegate = self
}
....
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("mCell", forIndexPath: indexPath)
cell.textLabel?.userInteractionEnabled = false
let listCell = cell as! ListTableViewCell
if let item = itemData.getItemData(indexPath.row) {
listCell.textLabel!.text = item.valueForKey("title") as? String
}
return cell
}
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
print("indexPathS")
}
}