【发布时间】:2017-01-26 08:11:26
【问题描述】:
extension FormViewController : UITableViewDelegate {
public func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath?
public func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath)
public func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
public func tableView(tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat
public func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
public func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView?
public func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
public func tableView(tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat
}
extension FormViewController : UITableViewDataSource {
public func numberOfSectionsInTableView(tableView: UITableView) -> Int
public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
public func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?
public func tableView(tableView: UITableView, titleForFooterInSection section: Int) -> String?
}
class NotifiableFormViewController: FormViewController
为什么我不能实现和覆盖 DataSource 和 TableViewDelegate?错误:“方法没有覆盖它的任何超类方法”
class FriendsTableViewController: NotifiableFormViewController{
override func numberOfSections(in tableView: UITableView) -> Int {
return 3
}
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: "LabelCell", for: indexPath)
cell.textLabel?.text = "Section \(indexPath.section) Row \(indexPath.row)"
return cell
}
override func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return "Section \(section)"
}
}
【问题讨论】:
-
这可能会有所帮助:stackoverflow.com/a/31432610/656600
-
我需要把它留在扩展中
标签: swift uitableview