获取索引路径后,如何获取自定义单元格的详细信息



我已经做了很多搜索,并使用以下代码获得了包含单击按钮的单元格的索引路径:

- (IBAction)buttonWasPressed:(id)sender
{
    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];
}

现在我的问题是如何像在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 中那样访问自定义单元格的属性

您可以通过调用tableView的cellForRowAtIndexPath:方法来访问单元格:

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];

试试这个:

 UITableViewCell* cell = [self cellForRowAtIndexPath:indexPath];

现在使用该单元格获取属性。

最新更新