简体   繁体   中英

how can I get my custom cell details after getting the index path

I have been doing a lot of searching and have managed to get the index path of the cell that holds the button that was clicked using this code:

- (IBAction)buttonWasPressed:(id)sender
{

    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:self.tableView];
    NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonPosition];

}

now my problem is how to I access the properties of the custom cell like I did in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

Try this:

 UITableViewCell* cell = [self cellForRowAtIndexPath:indexPath];

Now use that cell to get the properties.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM