我正在使用最新的Xcode6.3和SWIFT1.2。我以前运行的旧代码不再工作了。
我正试图在delegate方法中使用我的自定义UITableViewCellSearchResultsTableViewCell

func tableView(tableView: UITableView, willDisplayCell cell: SearchResultsTableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {

}

但是这个错误信息突然出现了
Objective-C method 'tableView:willDisplayCell:forRowAtIndexPath:' provided by method 'tableView(_:willDisplayCell:forRowAtIndexPath:)' conflicts with optional requirement method 'tableView(_:willDisplayCell:forRowAtIndexPath:)' in protocol 'UITableViewDelegate'

请帮忙。谢谢

最佳答案

不用把手机放在那里。如果UITableViewCell

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
//code

}

如果要访问,可以将UITableViewCell类型转换为所需的自定义单元格。

关于ios - 在Swift 1.2中无法在UITableViewDelegate方法中使用自定义TableViewCell类,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30196850/

10-10 17:50