繁体   English   中英

如何在情节提要中访问正确的导航控制器

[英]How to acces the right navigation controller inside storyboard

您可以在这里看到我的故事板。

在此处输入图片说明

我的问题是,现在我应该如何以正确的方式在代码中访问不同的导航控制器。 因为有时我会遇到一些麻烦。

例如,访问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];




}

答案就在故事板本身中。

Nav1是将屏幕推到选项卡1的根导航控制器。您将创建单独的导航控制器,并启动另一个导航流程。因此要获得Nav 2,剩下的必须依靠tabcontroller选项卡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];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM