0

您可以在這裏看到我的故事板。如何訪問故事板中的正確導航控制器

enter image description here

我的問題是,現在我應該如何在代碼中訪問不同的導航控制器以正確的方式。因爲有時我會遇到一些麻煩。

例如,訪問NAV 1和訪問NAV 2或NAV 3 ...之間有什麼區別?

任何幫助?謝謝

代碼設置標題

- (void)addEvent:(id)sender { 
    NSLog(@"pressed event"); 


    EKEventEditViewController *addController = [[EKEventEditViewController alloc] initWithNibName:nil bundle:nil]; 

    // set the addController's event store to the current event store. 
    addController.eventStore = self.eventStore; 
    addController.editViewDelegate = dataSource; 
    // present EventsAddViewController as a modal view controller 
    addController.title = @""; 
    self.title = @""; 
    self.parentViewController.title = @""; 
    self.navigationController.parentViewController.title = @""; 
    self.navigationController.visibleViewController.title = @""; 
    self.navigationController.title = @""; 
    self.navigationItem.title = @""; 
    addController.navigationItem.title = @""; 
    addController.navigationController.title = @""; 
    self.tabBarController.navigationController.title = @""; 
    [self presentModalViewController:addController animated:YES]; 




} 

回答

0

答案是有你的故事板本身。

Nav1是將屏幕向上推至標籤1的根控制器。在此創建單獨的導航控制器,並啓動另一個導航的流程,以便獲得導航2,並且您必須依賴於標籤控制器標籤1

編輯: 在VC

[self.navigationItem setTitle:@"Title"]; 

重新編輯設置標題:

插入一個導航控制器和模態呈現導航控制器

EKEventEditViewController* myController = [[EKEventEditViewController alloc] init]; 
myController.title = @"My Title"; 

UINavigationController* modalController = [[UINavigationController alloc] initWithRootViewController:myController]; 
[self presentViewController:modalController animated:YES completion:nil]; 

[modalController release]; 
[myController release]; 
+0

Oké,比方說,例如,我將模態VC推送到NAV4內的視圖控制器。但是我想設置那個模態VC的標題。我怎樣才能做到這一點? – Steaphann

+0

@StefGeelen:解答了答案 –

+0

@StefGeelen:self.title設置標題 –

相關問題