2012-01-11 92 views
1

我有這種說法棧:賽格瑞不工作作爲推動,只能作爲模態

UIViewController --> (Modal segue) --> 
UITabBarController --> (relationship) --> 
UINavigationController --> (relationship) --> 
UITableViewController --> (segue) --> UIViewController 

這是在我的UITableViewController賽格瑞代碼:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    NSLog(@"selected row..."); 
    [self performSegueWithIdentifier:@"showVmail" sender:self]; 
    NSLog(@"done segue"); 
} 

- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender 
{ 
    if ([[segue identifier] isEqualToString:@"showVmail"]) { 
     NSLog(@"Got segue request..."); 
     NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; 

     [segue.destinationViewController setMyVmail: [self.vmails objectAtIndex:indexPath.row]]; 

    } 
} 

當我點擊了我看到這些日誌消息:

selected row... 
Got segue request... 
Setting myVmail... // from the new view controller 
done segue 

而且它不會移到我的新視圖cont滾筒。 如果我更改爲模態,則繼續運行,但當然沒有後退按鈕。據我所知,我已經做好了一切準備。我讀了很多關於堆棧溢出的迴應,同樣的問題,他們的解決方案是放在UINavigationController中。我已經做到了。

任何想法將不勝感激!

回答

0

我試過看過的其他建議,你應該回到簡單的案例。我改變了故事板中的UINavigationController以指向一個基本的UIViewController,然後爲此擁有一個可以與另一個UIViewController相關聯的按鈕。當我跑它時,我仍然有我的UITableViewController!

那是當我記住我正在編程地填充UITabBarController中的對象,並且我沒有調用UINavigationController,而是跳過並調用UITableViewController!所以實際上,我真的遇到了與其他人相同的問題,錯過了UINavigationController!

更改我的程序以鏈接UINavigationController而不是UITableViewController,現在所有程序都按預期工作。