ios – 如何从Swift的indexPath获取UITableViewCell对象?

我试图使用 swift以编程方式获取UITableViewCell对象,所以我写了这个代码
let cell:UITableViewCell = (UITableViewCell) UITableView.cellForRowAtIndexPath(indexPath.row)

但是得到编译错误为:

error image http://www.imagesup.net/?di=8140698032514

请帮忙!

解决方法

cellForRowAtIndexPath不是一个类的方法.改用实例方法.
let cell = tableView.cellForRowAtIndexPath(indexPath)

Swift 3:

let cell = tableView.cellForRow(at: indexPath)

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...