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.
To actually prevent selection you need to implement tableView:willSelectRowAtIndexPath: on your UITableViewDelegate and return nil for non-selectable rows.
A table view displays a single column of vertically scrolling content, divided into rows and sections. Each row of a table displays a single piece of information related to your app. Sections let you group related rows together. For example, the Contacts app uses a table to display the names of the user's contacts.
tableView(_:didSelectRowAt:)Tells the delegate a row is selected.
[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];
You should try:
[self tableView:self.tableView didSelectRowAtIndexPath:YourIndexPath]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With