【问题标题】:Get reference of tableView through a UITableViewCell通过 UITableViewCell 获取 tableView 的引用
【发布时间】:2026-01-16 10:20:07
【问题描述】:

是否可以获取已添加 UITableViewCell 的 tableView 的引用? 我的意思是,如果我有一个 UITableViewCell 并且我想知道你的 tableView 是谁,我能找到吗? 是否存在某些属性或什么?

提前致谢

【问题讨论】:

    标签: iphone ios uitableview


    【解决方案1】:

    你确定需要这个吗?

    您可能会考虑重新编写代码以避免这种需要。

    【讨论】:

      【解决方案2】:

      好吧,UITableViewCell 继承自 UIView。这个线程Reference from UITableViewCell to parent UITableView? 建议使用self.superview

      【讨论】: