I am making an iPad SplitView App where I have the MasterView table on the left(in landscape orientation) and the DetailView on the right(nothing new so far...). When I click on a table cell, the detailView shows the cell details. I got also a button on the detialView to move forward to the next cell and a button to move backward to the previous cell.
My problem is that I would like to change the cell selection in the table view on the left every time I click on a button so the user knows on which cell he currently is.
I tried by calling the tableView: didSelectRowAtIndexPath: method but I can't seem to set the NSIndexPath right(I want to send an integer to indicate the number of the next cell).
Here is the code that's trzing to call the selectRowAtIndexPath: method:
iPadHelloWorldAppDelegate is the AppDelegate. masterViewController is the master controller with the table on it.
// method to set the image for the previous letter
-(IBAction)previousLetter{
iPadHelloWorldAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSLog(@"IndexOfImage equals: %@", appDelegate.indexOfImage);
int number = [[appDelegate.indexOfImage substringFromIndex:5] intValue];
NSString *imageName = [NSString stringWithFormat:@"image%@.png",[NSString stringWithFormat:@"%d", number-1]];
[self.letterImageView setImage:[UIImage imageNamed:imageName]];
NSLog(@"Image name: %@", imageName);
appDelegate.indexOfImage = [imageName substringToIndex:6];
NSIndexPath *currentPath = appDelegate.currentPath;
NSIndexPath *nextPath = [NSIndexPath indexPathForRow:currentPath.row-1 inSection:currentPath.section];
[masterViewController.tableView selectRowAtIndexPath:nextPath animated:YES scrollPosition:UITableViewScrollPositionNone];
NSLog(@"currentPath: %@", currentPath);
appDelegate.currentPath = nextPath;
NSLog(@"nextPath: %@", nextPath);
Please help...