iphone - 从 UITableViewCell 到父 UITableView 的引用?

标签 iphone objective-c cocoa-touch

有没有办法从 UITableViewCell 中访问拥有的 UITableView

最佳答案

在单元格中存储对 tableView 的 weak 引用,您可以在表格数据源的 -tableView:cellForRowAtIndexPath: 中设置该引用。

这比依赖 self.superview 总是准确的 tableView 是脆弱的要好。谁知道Apple将来会如何重新组织UITableView的 View 层次结构。

关于iphone - 从 UITableViewCell 到父 UITableView 的引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1110482/

相关文章:

iphone - iPad : UIImage imageWithContentsOfFile performance problems

ios - 通过 View Controller 、标签栏 Controller 、导航 Controller 和 View Controller 传递数据

ios: UIScrollView scrollRectToVisible 不工作

iphone - UITableViewCell 中复选标记的问题

iphone - UITabBar 隐藏时留下一个白色矩形

iphone - 与新应用程序版本同步更改应用程序内购买名称

iPhone:无法在drawRect之外的屏幕上绘图?

iphone - ABPeoplePickerNavigationController 内存泄漏?

iphone - 启动应用程序时的后台通知

ios - AVAsset Export 设置恒定的帧率