0

You can see my storyboard over here.

enter image description here

My question is now how should I access in code the different navigation controllers in a correct way. Because sometimes I get some troubles with it.

For example what is the difference between accessing NAV 1 and accessing NAV 2 or NAV 3 ... .

Any help? Thank you

Code for setting title

- (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];




}
Steaphann
  • 2,797
  • 6
  • 50
  • 109

1 Answers1

0

The answer is there in your storyboard itself.

Nav1 is the root navigation controller that pushes the screens upto the tab 1 .There you are creating separate Navigation controllers and the flow of another navigation is started.so to get the Nav 2 and remaining you have to depend on the tabcontroller tab 1

EDIT : Setting the title in a VC

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

ReEdit:

Insert a navigation controller and modally present the navigation controller

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];
Lithu T.V
  • 19,955
  • 12
  • 56
  • 101