在Swift中,我们可以使用tableView(_:didSelectRowAt:)方法来获取到被选中的cell。在这个方法中,我们可以使用tableView.cellForRow(at:)方法来获取到指定indexPath位置的cell。下面是一个例子:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    // 获取到被选中的cell
    let cell = tableView.cellForRow(at: indexPath)
    
    // 进行其他操作
    // ...
}

在这个例子中,我们通过tableView.cellForRow(at:)方法获取到了被选中的cell,并将其赋值给了cell常量。然后我们可以对这个cell进行其他操作,例如修改其样式、内容等。

swiftfunc tableView_ tableView UITableView didSelectRowAt indexPath IndexPath 获取到cell

原文地址: http://www.cveoy.top/t/topic/h9H7 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录