简体   繁体   English

在几个情节提要板上维护导航栏?

[英]Maintain navigation bar over several storyboards?

For objective-c, using Xcode 5.1 (all that is available to me), how would you maintain the navigation bar when creating separate storyboards? 对于Objective-c,使用Xcode 5.1(我可以使用的全部功能),在创建单独的故事板时如何维护导航栏? If the view controllers are all in one storyboard then the navigation bar is easy, but as soon as you put a view controller in a new storyboard it loses all ability to interact with the other navigation controller. 如果视图控制器全部都位于一个情节提要中,则导航栏很容易,但是一旦将视图控制器放在新的情节提要中,它就会失去与另一个导航控制器进行交互的所有功能。 Thank you 谢谢

Edit: When I transfer control I use code such as the following: 编辑:当我转移控制权时,我使用如下代码:

 ‑ (IBAction)displayAccountSettings:(id)sender
{
    UIViewController *mainViewController = 
        [[UIStoryboard storyboardWithName:@"AccountSettings" bundle:nil]
          instantiateInitialViewController];

    [self presentViewController:mainViewController
                       animated:YES
                     completion:nil];
}

I have also tried to add this: 我也尝试添加以下内容:

 [self.navigationController pushViewController:mainViewController animated:YES];

and that seemed to do nothing. 这似乎无济于事。 Basically I'm trying to have a homescreen which has several buttons on it, and each button links to a different storyboard (I would like different storyboards as I'm working on the project with several people). 基本上,我试图拥有一个带有多个按钮的主屏幕,并且每个按钮都链接到不同的故事板(与多个人一起从事该项目时,我希望使用不同的故事板)。 We need to keep the navigation bar at the top, however. 但是,我们需要将导航栏保持在顶部。 And it disappears with this method. 用这种方法就消失了。

Embed the storyboards within childview controller. 将情节提要板嵌入childview控制器中。 That way the nav bar will be everywhere. 这样,导航栏将无处不在。 You have to do the embedding in code or copy all storyboards into one big storyboard to do create that in IB. 您必须进行代码嵌入或将所有情节提要板复制到一个大的情节提要板中,才能在IB中创建它。

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

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