I have an NSArray tablePeople
which makes up my UITableView on my 1st View Controller PeopleController
. I have a UILabel personsName
on my second View Controller PeopleDetailsController
which I want to update with the contents of cell.textLabel.text
of each row in my TableView. I have this method but it's not working:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
((PeopleController *)segue.destinationViewController).delegate=self;
if ([[segue identifier] isEqualToString:@"toPeopleArticle"]) {
NSIndexPath *indexPath = (NSIndexPath *)sender;
PeopleDetailsController *mdvc = segue.destinationViewController;
mdvc.personsName.text = [self.tablePeople objectAtIndex: indexPath.row];
}
}
I also have this code when the cell is selected:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"toPeopleArticle" sender:indexPath];
}
I have to note that PeopleDetailsController
is a modal view and PeopleController
is a navigation view controller.
EDIT: The text on the UILabel on the 2nd VC is just not being updated, it stays the same, that's the whole problem.