Good afternoon,
I'm trying to create three segues inside my TableViewController in a custom cell and currently it's not working because I can't send the correct "username" throught the second and the third segue.
The second and the third segue are triggered when the user press the UIImageView and a UILabel (which are connected to a TapGestureRecognizer), and in those two segues I have the problem, because the "username" is not updated (it's always the same, the first one in my TableViewController).
What is wrong with my code? I'm going to post some screenshots of my StoryBoard because I don't know where is something wrong...
Here you are my Segue code (the first one is working fine):
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *myIndexPath = [self.tableView indexPathForSelectedRow];
NSLog(@"RecipeName ==> %@", [[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"username"]);
if ([[segue identifier] isEqualToString:@"ShowCarDetails"])
{
CarDetailViewController *detailViewController = [segue destinationViewController];
detailViewController.carDetailModel = [[NSArray alloc]
initWithObjects:
[[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"date"],
[[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"id"],
[[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"imagen"],
nil];
}
if ([segue.identifier isEqualToString:@"segueprofile"]) {
OtherProfileUserViewController *destViewController = [segue destinationViewController];
destViewController.recipeName = [[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"username"];
}
if ([[segue identifier] isEqualToString:@"segueprofile2"])
{
OtherProfileUserViewController *destViewController = [segue destinationViewController];
destViewController.recipeName = [[_jsonArray objectAtIndex:[myIndexPath row]] valueForKey:@"username"];
}
}
Here you are my screenshots from my StoryBoard:
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire