2012-01-20 40 views
3

我有一个iOS 5应用程序,有一个故事板和两个场景。场景1是一个选择列表,而场景2示出了用于每个选择iOS 5赛后的黑屏

在场景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]; 
    } 
} 

在场景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 delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show];   

    nameCell.textLabel.text= msg; 

    [super viewDidLoad]; 
} 

的这一切工作正常,并警告框显示了正确的变量并没有对新场景的过渡。但是,警告框总共会在&之上显示5次,一旦完成,整个窗口就会变黑。我的场景(场景2)中没有任何内容显示在该点上。所以我知道我有正确的继续,它根据需要过渡,我只是不能看到我的屏幕上的任何东西。

回答

12

我遇到了非常相似的情况。我曾无意中取消注释的方法:

-(void)loadView 

相信此方法重写IB接口,并从这个代码,而不是创建它。检查以确保它被删除或注释掉恕我直言。

+0

你有GOT在开玩笑吧。这是正确的答案。男人,我讨厌小东西刚刚出现并咬你!谢谢您的帮助。 –

+0

这只是...糟糕。我正在学习ios,这是杀了我。我准备好删除该项目并重新开始。谢谢一堆。 – knaak

+0

这适用于我的一个场景,但不适用于其他场景。无论如何,谢谢! – Sheharyar