Reference from UITableViewCell to parent UITableView?

Store a weak reference to the tableView in the cell, which you’d set in -tableView:cellForRowAtIndexPath: of your table’s dataSource.

This is better than relying on self.superview to always be exactly the tableView is fragile. Who knows how Apple might re-organize the view hierarchy of UITableView in the future.

Leave a Comment