相关疑难解决方法(0)

在segue之后的iOS 5黑屏

我有一个带有故事板和两个场景的iOS 5应用程序.场景1是选择列表,而场景2显示每个选择的细节

在场景1中,我需要传递一个变量,我这样做:

//Handles the selection 
-(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];
    }
}
Run Code Online (Sandbox Code Playgroud)

在场景2(详细信息)中,我使用它来验证是否收到了正确的变量

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    NSString *msg = [[NSString alloc] initWithFormat:@"You have selected %@", guestSelected];
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Selection" message:msg …
Run Code Online (Sandbox Code Playgroud)

objective-c ios-simulator ios5

3
推荐指数
1
解决办法
4004
查看次数

标签 统计

ios-simulator ×1

ios5 ×1

objective-c ×1