Rossi
Rossi

Reputation: 609

Can I programmatically modify which UITableViewCell is selected?

Is there a way to move the highlighted tableviewcell programatically. If I wanted to highlight cell number 3 and then highlight cell number 4 instead, based on something the user did in the detail view of my split view controller, can I do this?

Is there a way I can get the indexpath for the row two below one that I have?

Thanks!

Upvotes: 0

Views: 752

Answers (1)

John Parker
John Parker

Reputation: 54445

You can do this via the UITableView selectRowAtIndexPath:animated:scrollPosition: method.

In terms of getting the "next" row from the indexPath, you can simply use the indexPath.row property (as supplied from your UITableViewDelegate's tableView:didDeselectRowAtIndexPath: method) as the basis for the selected row.

Upvotes: 1

Related Questions