My answer with thanks to @dasblinkenlight for pointing me in the right direction...
Properties:
// public - receives an array of values for the 'previously selected cells'
@property (nonatomic, strong) NSArray *arrayObjects;
// private
@property (nonatomic, strong) NSIndexPath *indexPathObjectFromArray;
In viewWillAppear:
NSManagedObject *selectManagedObjects = nil;
NSManagedObject *checkManagedObject = nil;
NSFetchedResultsController *frc = nil;
NSArray *fetchedObjects = nil;
NSInteger nofSectionsInTableView;
NSInteger nofRowsInSection;
NSInteger currentSection = 0;
NSInteger currentRow = 0;
// possible more than one object selected - we want the last or bottom-most object
selectManagedObjects = self.arrayObjects.lastObject;
frc = self.fetchedResultsController;
fetchedObjects = frc.fetchedObjects;
nofSectionsInTableView = frc.sections.count;
while (currentSection < nofSectionsInTableView && self.indexPathObjectFromArray == nil) {
nofRowsInSection = [[frc.sections objectAtIndex:currentSection] numberOfObjects];
for (int sectionRow = 0; sectionRow < nofRowsInSection; sectionRow++) {
checkManagedObject = [fetchedObjects objectAtIndex:currentRow];
if (checkManagedObject == selectManagedObjects) {
[self setIndexPathObjectFromArray:[NSIndexPath indexPathForRow:sectionRow
inSection:currentSection]];
break;
}
currentRow++;
}
currentSection++;
}
In viewDidAppear:
[self.tableView scrollToRowAtIndexPath:self.indexPathObjectFromArray
atScrollPosition:UITableViewScrollPositionNone
animated:YES];
Note the use of UITableViewScrollPositionNone
- this ensures that if the bottom-most previously selected cell is in the initial view (and therefore scrolling is not required), then no scrolling will occur.