I have an iOS 5 app with a storyboard and two scenes. Scene 1 is a selection list, while Scene 2 shows the details for each selection.
In Scene 1, I need to pass a variable, and I do this with:
-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
Guests *myGuests =[guestList objectAtIndex:[indexPath row]];
selectedGuest = [[NSString alloc] initWithFormat:@"You have selected %@", myGuests.guestID];
[self performSegueWithIdentifier:@"TGG" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([[segue identifier] isEqualToString:@"TGG"]){
GuestDetailsViewController *vc = [segue destinationViewController];
[vc setGuestSelected:selectedGuest];
}
}
In Scene 2 (details), I use this to make sure the right variable is obtained as
- (void)viewDidLoad
{
NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@", guestSelected];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selection" message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
nameCell.textLabel.text= msg;
[super viewDidLoad];
}
All this works fine, and the right variable is displayed in the warning window and a transition to a new scene takes place. HOWEVER, a warning window displays a total of 5 times over and over, and upon completion, the entire window turns black. None of my scene (Scene 2) is displayed at this point. Therefore, I know that I have the right segment, it goes as desired, I just don’t see anything on my screen.