<legend id='LOY8f'><style id='LOY8f'><dir id='LOY8f'><q id='LOY8f'></q></dir></style></legend>
    <bdo id='LOY8f'></bdo><ul id='LOY8f'></ul>
  • <small id='LOY8f'></small><noframes id='LOY8f'>

    <i id='LOY8f'><tr id='LOY8f'><dt id='LOY8f'><q id='LOY8f'><span id='LOY8f'><b id='LOY8f'><form id='LOY8f'><ins id='LOY8f'></ins><ul id='LOY8f'></ul><sub id='LOY8f'></sub></form><legend id='LOY8f'></legend><bdo id='LOY8f'><pre id='LOY8f'><center id='LOY8f'></center></pre></bdo></b><th id='LOY8f'></th></span></q></dt></tr></i><div id='LOY8f'><tfoot id='LOY8f'></tfoot><dl id='LOY8f'><fieldset id='LOY8f'></fieldset></dl></div>

      <tfoot id='LOY8f'></tfoot>

        如何进入“主页"在 iOS 应用程序中?

        时间:2023-06-10

          1. <legend id='YTi4z'><style id='YTi4z'><dir id='YTi4z'><q id='YTi4z'></q></dir></style></legend>

            <small id='YTi4z'></small><noframes id='YTi4z'>

            <tfoot id='YTi4z'></tfoot>

            <i id='YTi4z'><tr id='YTi4z'><dt id='YTi4z'><q id='YTi4z'><span id='YTi4z'><b id='YTi4z'><form id='YTi4z'><ins id='YTi4z'></ins><ul id='YTi4z'></ul><sub id='YTi4z'></sub></form><legend id='YTi4z'></legend><bdo id='YTi4z'><pre id='YTi4z'><center id='YTi4z'></center></pre></bdo></b><th id='YTi4z'></th></span></q></dt></tr></i><div id='YTi4z'><tfoot id='YTi4z'></tfoot><dl id='YTi4z'><fieldset id='YTi4z'></fieldset></dl></div>
                • <bdo id='YTi4z'></bdo><ul id='YTi4z'></ul>
                    <tbody id='YTi4z'></tbody>
                  本文介绍了如何进入“主页"在 iOS 应用程序中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有 UIViewControllerUITabBarController.UIViewController 包含 5 个按钮,UITabBarController 有 5 个选项卡.

                  I have UIViewController and UITabBarController. UIViewController contain 5 buttons and UITabBarController has 5 Tabs.

                  通过点击第一个按钮应用显示 TabBarController 与第一个选定的选项卡,第二个 - TabBarController 与第二个选项卡,依此类推...

                  By tapping first button app shows TabBarController with the first selected tab, second - TabBarController with the second tab and so on...

                  为了准备这个,我对每个按钮都使用了 Modal-segue.

                  To prepare this I have used Modal-segue for every button.

                  一切正常.

                  现在我需要在 TabBarControllerUINavigationBar 上创建主页"按钮(可能以编程方式),它将执行返回主页视图"操作.

                  Now I need to create "Home" button (may be programmatically) on TabBarController's UINavigationBar, which will execute "Go home view" action.

                  编辑了更多细节

                  {见下面的截图}

                  1. 初始 UIViewController
                  2. UITabBarController
                  3. 导航控制器
                  4. UIViewControllers

                  12 之间有两个模态转场(两个按钮 - 两个转场)

                  There are TWO modal-segues between 1 and 2 (two buttons - two segues)

                  在 UIViewController 中的 prepareForSegue 中:

                  In my prepareForSegue in UIViewController:

                  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
                  {
                      AppDelegate *d = (AppDelegate *)[[UIApplication sharedApplication] delegate];
                      if ([segue.identifier isEqualToString:@"s1"]) {
                          d.initialTab = 0;
                      }
                      else if ([segue.identifier isEqualToString:@"s2"]) {
                          d.initialTab = 1;
                      }
                  }
                  

                  在我的 viewDidLoad 中的 UITabBarController:

                  In my viewDidLoad in UITabBarController:

                  TabController *mainTabController = (TabController *)self;
                      AppDelegate *d = (AppDelegate *)[[UIApplication sharedApplication] delegate];
                      [mainTabController setSelectedIndex:d.initialTab];
                  

                  这是可行的!

                  但是我需要回到主页.因此,如果 TabBarController 之后有 NavigationController,我想在 NavigationBar 中创建一个按钮.

                  But I need to go back to home-page. So if there is a NavigationController after TabBarController I would like to create a button in NavigationBar.

                  推荐答案

                  我建议你以一个 Navigation Controller 作为父级.
                  然后,将您的启动视图添加为它的根视图.

                  I suggest you to take a one Navigation Controller as a parent.
                  Then, add your Startup View as a root view of it.

                  在您的主视图控制器页面上,

                  On your main view controller page,

                  - (void)viewWillAppear:(BOOL)animated
                  {
                     self.navigationController.navigationBarHidden = NO;
                  }
                  

                  因此,它将隐藏您的主导航.所以无需担心这个内部导航流程.
                  而对于内部导航,您已经采用了不同的导航控制器.

                  So, it will hide your main navigation. So no need to worry for this internal navigation flow.
                  And for internal navigation, you have already taken different navigation controllers.

                  通过使用代码:

                  [self.parentViewController.navigationController popToRootViewControllerAnimated:YES];
                  

                  您将位于应用程序的根目录,它将弹出所有堆叠在应用程序中的视图控制器.

                  you'll be at root of the application and it will poped out all view controller which were stacked in application.

                  希望您能理解流程和如果您感觉良好,将申请.

                  Hopefully, you'll understand flow & will apply if you feel good.

                  享受编码.
                  谢谢.

                  Enjoy Coding.
                  Thanks.

                  这篇关于如何进入“主页"在 iOS 应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:不使用整个屏幕的导航控制器 下一篇:如何在 iphone 应用程序中设置 UINavigationBar 的高度

                  相关文章

                    <bdo id='FpRhk'></bdo><ul id='FpRhk'></ul>
                    <tfoot id='FpRhk'></tfoot>

                      <legend id='FpRhk'><style id='FpRhk'><dir id='FpRhk'><q id='FpRhk'></q></dir></style></legend>

                    1. <small id='FpRhk'></small><noframes id='FpRhk'>

                      <i id='FpRhk'><tr id='FpRhk'><dt id='FpRhk'><q id='FpRhk'><span id='FpRhk'><b id='FpRhk'><form id='FpRhk'><ins id='FpRhk'></ins><ul id='FpRhk'></ul><sub id='FpRhk'></sub></form><legend id='FpRhk'></legend><bdo id='FpRhk'><pre id='FpRhk'><center id='FpRhk'></center></pre></bdo></b><th id='FpRhk'></th></span></q></dt></tr></i><div id='FpRhk'><tfoot id='FpRhk'></tfoot><dl id='FpRhk'><fieldset id='FpRhk'></fieldset></dl></div>