结束显示时如何更改CustomCell?
How to change CustomCell when it ends display?
我想更改此代码:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
像那样:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: CustomCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
但我收到一条错误消息。
当它消失时,我需要更改我的 CustomCell。我该如何处理?
使用原始方法签名,并使用可选转换访问CustomCell
:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if let cell = cell as? CustomCell {
// do something with cell
}
}
我想更改此代码:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
像那样:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: CustomCell, forRowAtIndexPath indexPath: NSIndexPath) {
}
但我收到一条错误消息。 当它消失时,我需要更改我的 CustomCell。我该如何处理?
使用原始方法签名,并使用可选转换访问CustomCell
:
override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if let cell = cell as? CustomCell {
// do something with cell
}
}