dimanche 22 juin 2014

how to load different data into the table view from different arrays depending on what row is clicked using storyboards on iOS7?


Vote count:

0




I am learning iOS development and working on sample ios application. I got some doubts in TableView, I wish to load different data into the table view from different arrays depending on what row is clicked. I done this using xcode 4 with nib files, I have written didSelectRowAtIndexPath method in implementation file


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { PetsTableViewController *pets = [[PetsTableViewController alloc]initWithNibName:@"PetsTableViewController" bundle:nil]; if([[petsArray objectAtIndex:indexPath.row ]isEqual:@"Dog"]) { pets.petsInt = 0; [pets setTitle:[petsArray objectAtIndex:indexPath.row]]; } if([[petsArray objectAtIndex:indexPath.row ]isEqual:@"Cat"]) { pets.petsInt = 1; [pets setTitle:[petsArray objectAtIndex:indexPath.row]]; } if([[petsArray objectAtIndex:indexPath.row ]isEqual:@"Snake"]) { pets.petsInt = 2; [pets setTitle:[petsArray objectAtIndex:indexPath.row]]; } [self.navigationController pushViewController:pets animated:YES]; // [pets release]; }


this is the sample code, here i declared dog, cat, snake arrays in table 1. When i clicked any of this row it should display


dog -> dog1, dog2, dog3 arrays with each row in a different table (table 2).


How to do this using storyboard with xcode 5 ? (using segues )


Please share your thoughts about it



asked 38 secs ago






Aucun commentaire:

Enregistrer un commentaire