我有一个customCell,并在单元格中添加了一些按钮。
SettingTableViewCell * cell = (SettingTableViewCell *)[[sender superview] superview];
NSIndexPath * path = [self.tableView indexPathForCell:cell];如何理解第二句!
非常感谢!
发布于 2014-03-19 05:59:12
不知道你想做什么。但我解释了这两句话。
[sender superview],这意味着,您可以单击按钮,这就是为什么,您将得到这个放在单元格内容视图上的sender。然后再次调用superview],这样就可以得到单元格中的superview of content view。参见下面的视图层次结构。
----cell
-------ContentView
-------------SenderNSIndexPath * path = [self.tableView indexPathForCell:cell];。这一行将为保存在tableview单元堆栈中的相应单元格提供indexPath。
https://stackoverflow.com/questions/22497413
复制相似问题