gpt4 book ai didi

ios - 在 iOS 中访问自定义 UITableViewCell 中的 View

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:59:59 26 4
gpt4 key购买 nike

我有一个 UITableView,它由来自另一个 XIB 文件的单元格填充。如何在 tableView 的 didSelectRowAtIndexPath 方法中访问单元格的 View (例如标签)?

最佳答案

使用cellForRowAtIndexPath:

let cell = tableView.cellForRowAtIndexPath(indexPath) as! YourCustomCell

然后你可以访问它的标签:

cell.customLabel.text = "test"

关于ios - 在 iOS 中访问自定义 UITableViewCell 中的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32388994/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com