0

我的应用程序由左侧的滑出菜单导航。在每个viewController之上是左侧UIBarButton标题为“导航”,当触摸时,打开滑出菜单而不必执行拖动效果。我正在将语音命令应用到我的应用中,如果用户说“去财务”,它会跳到viewController,标题为FianceViewControllerinstantiateViewControllerpushViewController当pushViewController被调用时,后退按钮覆盖了之前的UIBarButton

这一切工作正常,唯一的问题是后推按钮与推segue相关涵盖了我的“导航”按钮在左边的插槽UINavigationBar。使用self.navigationItem.hidesBackButton = YES;隐藏后退按钮和我的“导航”按钮。反正有没有做出后退按钮出现,但仍然允许我以前创建的“导航”栏按钮被看到和使用?或者是否有其他类型的segue,我可以做的不是push,如果这个UIBarButton难题无法解决?

段代码说话时塞格斯:

if ([title isEqualToString:@"FINANCES"]) 
{ 

    FinanceViewController *fvc = [[self storyboard] instantiateViewControllerWithIdentifier:@"finance"]; 
    [[self navigationController] pushViewController:fvc animated:YES]; 

} 

回答

0

而不是躲在我的后退按钮,我想通了,我可以简单地在它写!在pushViewController之前使用fvc.navigationItem.leftBarButtonItem = self.navigationItem.leftBarButtonItem;,允许“导航”按钮覆盖后退按钮。

0

你是如何加入导航按钮? 我会尝试将它隐藏后退按钮,这样的事情之后添加:

self.navigationItem.hidesBackButton = YES; 
UIButton *navigationButton = [[UIButton alloc] initWithFrame:CGRectMake(15.0, 15.0, 100.0, 32.0)]; 
self.navigationController.navigationBar.backItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:navigationButton]; 
+0

我已经添加了创建导航按钮的代码。它的技巧很棘手,因为这是在'rootViewController'中声明的,而不是单独的'viewController's,所以让我知道你的想法。 – momodude22

相关问题