mardi 3 mars 2015

Array data from table view to label

I've got a tableview setup to display data from an sqlite database, now what I am trying to do is setup a view to display further information from said database when the user clicks on a table cell.


From what I've read so far my understanding that this is done mainly in the prepareForSegue method inside the table view's controller?


Anyway, after a lot of googling I've ended up with this from an AppCoda tutorial (link)...



if([segue.identifier isEqualToString:@"pushToMountainInfo"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
UINavigationController *nav = segue.destinationViewController;
MountainInformation *destViewController = [nav.viewControllers objectAtIndex:0];
MountainsObject *mountain = [self.mountains objectAtIndex:indexPath.row];
destViewController.nameLabel = mountain.name;
NSLog(@"%@", mountain.name);
}


I put the NSLog there to test, and it does output the mountain's name to the log but the label remains blank when I run the app.


Can anybody please help? Thanks..!


Aucun commentaire:

Enregistrer un commentaire