【发布时间】:2015-06-29 10:04:12
【问题描述】:
我有一个带有视图控制器的情节提要。视图控制器分为两半,一半是 UI 日期选择器,另一半是表格视图。当我将视图控制器设置为委托和数据源时,出现以下错误
reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x7fdb29b4d9e0'
我的View控制器是这样定义的
import Foundation
import UIKit
class CustomViewController: UIViewController , UITableViewDelegate , UITableViewDataSource{
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return 3;
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
var sampleCell = tableView.dequeueReusableCellWithIdentifier("cell") as! UITableViewCell
return sampleCell;
}
}
【问题讨论】:
标签: ios swift uitableview