I have a table with sections, populated by an array which is comprised of four arrays. How do I modify the indexPathForSelectedRow statements in the prepare for segue method to include section information?
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier]isEqualToString:@"plantSaveSegue"])
{
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
DetailViewController *grassType = [segue destinationViewController];
//grassType.selectedPlant = [grassArray objectAtIndex:selectedRowIndex.row];
grassType.selectedPlant = [plantArray objectAtIndex:selectedRowIndex.row];
}
}
This works perfectly for one section, but what do I do for four sections?
Declare 2 NSIntegers in the .h file
and now in your viewDidLoad(), initialize these to "-1"
Now in
After that
Hope This Helps