Flatlyn
Flatlyn

Reputation: 2050

Manually trigger cell select TableView

I need to manually programmatically trigger a cell select on my tableView. Essentially running the pre-made function

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

I'm doing this in order to when an item is deleted from the tableView it will automatically load the next item. However when I try to manually call this function it can't seem to be found. I've tried

self.tableView: didSelectRowAtIndexPath

and

[tableView didSelectRowAtIndexPath]

but neither is recognised.

Upvotes: 6

Views: 3452

Answers (2)

wattson12
wattson12

Reputation: 11174

[self tableView:self.tableView didSelectRowAtIndexPath:selectedIndexPath];

replace selectedIndexPath with whatever the next row is

make sure self is your table view delegate

edit: I know this is an old question but really this should be done with [tableView selectRowAtIndexPath:path animated:YES scrollPosition:UITableViewScrollPositionMiddle];

Upvotes: 5

The dude
The dude

Reputation: 7924

You should try:

[self tableView:self.tableView didSelectRowAtIndexPath:YourIndexPath]

Upvotes: 1

Related Questions