相关疑难解决方法(0)

想要在Swift中重新定义willDisplayCell方法。如何重新定义类方法

我在自定义单元格类中使用某些UI组件,我想在willDisplayCell方法中进行配置。最初的定义是

public func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath)
Run Code Online (Sandbox Code Playgroud)

现在使用cell.myTextField.text = "customise" 给出错误,即单元格没有任何组件作为myTextField

为了解决这个问题,我将不得不重新定义方法

public func tableView(tableView: UITableView, willDisplayCell cell: **myCustomCellClass**, forRowAtIndexPath indexPath: NSIndexPath)
Run Code Online (Sandbox Code Playgroud)

任何有关如何执行此操作以及随后如何快速重新定义任何当前类方法的线索都将是很棒的。提前致谢。

oop uitableview ios swift

1
推荐指数
1
解决办法
5772
查看次数

标签 统计

ios ×1

oop ×1

swift ×1

uitableview ×1