2012-01-24 20 views
0

這是一個新手問題。我創建了一個分組tableview。在點擊tableview單元格時,它導航到一個新的view.but im無法創建一個後退按鈕連。我加入筆尖的第二視圖導航欄file.but沒有effect..could你們幫我out..below它是第一種觀點當從一個表視圖導航到另一個時,無法創建一個後退按鈕

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
// Navigation logic may go here. Create and push another view controller. 

    if (indexPath.row==0) { 
    self.dvController1 = [[FirstView alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]]; 
    [self.navigationController pushViewController:dvController1 animated:YES]; 
     } 

if (indexPath.row==1) { 
    self.dvController2 = [[Tab4 alloc] initWithNibName:@"Tab4" bundle:[NSBundle mainBundle]]; 
    [self.navigationController pushViewController:dvController2 animated:YES]; 

} 


} 

enter image description here

的截圖和代碼

enter image description here

回答

0

在pr esented控制器它添加一個按鈕與IBAction

- (IBAction)back:(id)sender { 
    [self.navigationController popViewControllerAnimated:YES]; 
} 

,並確保你有一個navigationController確實(也就是說你的應用程序需要導航定向,這意味着你需要實例化navigationController屬性的應用代表)

+0

DAT完全工作......但我面臨的另一個problem..in上面的屏幕shot.if IM點擊第一行它帶我到一個新的視圖包含tabbar項目..其中每個tabbar包含tableView與navigationController ..如何以編程方式添加一個按鈕...將更新您的屏幕截圖。 – kingston

-1

只是隱藏在viewWillAppear方法中的酒吧&取消隱藏tableViewController類的viewWillDisAppear方法中的酒吧。通過使用

self.navigationController.navigationBarHidden = YES/NO; 
0

在你的第二個觀點。把這個代碼在viewDidLoad方法

  self.navigationItem.leftBarButtonItem.title = @"Back"; 
相關問題