1. <legend id='77oIh'><style id='77oIh'><dir id='77oIh'><q id='77oIh'></q></dir></style></legend>
      <i id='77oIh'><tr id='77oIh'><dt id='77oIh'><q id='77oIh'><span id='77oIh'><b id='77oIh'><form id='77oIh'><ins id='77oIh'></ins><ul id='77oIh'></ul><sub id='77oIh'></sub></form><legend id='77oIh'></legend><bdo id='77oIh'><pre id='77oIh'><center id='77oIh'></center></pre></bdo></b><th id='77oIh'></th></span></q></dt></tr></i><div id='77oIh'><tfoot id='77oIh'></tfoot><dl id='77oIh'><fieldset id='77oIh'></fieldset></dl></div>
      • <bdo id='77oIh'></bdo><ul id='77oIh'></ul>
      1. <tfoot id='77oIh'></tfoot>

        <small id='77oIh'></small><noframes id='77oIh'>

        以相同的动作弹出和推送视图控制器

        时间:2023-06-12
        <tfoot id='xd2SP'></tfoot>
        <legend id='xd2SP'><style id='xd2SP'><dir id='xd2SP'><q id='xd2SP'></q></dir></style></legend>

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

            <bdo id='xd2SP'></bdo><ul id='xd2SP'></ul>
              <tbody id='xd2SP'></tbody>
                  <i id='xd2SP'><tr id='xd2SP'><dt id='xd2SP'><q id='xd2SP'><span id='xd2SP'><b id='xd2SP'><form id='xd2SP'><ins id='xd2SP'></ins><ul id='xd2SP'></ul><sub id='xd2SP'></sub></form><legend id='xd2SP'></legend><bdo id='xd2SP'><pre id='xd2SP'><center id='xd2SP'></center></pre></bdo></b><th id='xd2SP'></th></span></q></dt></tr></i><div id='xd2SP'><tfoot id='xd2SP'></tfoot><dl id='xd2SP'><fieldset id='xd2SP'></fieldset></dl></div>
                  本文介绍了以相同的动作弹出和推送视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以从导航堆栈中弹出一个视图,然后将另一个视图直接推送到它上面?

                  is is possible to pop a view off the navigation stack and then push another straight onto it?

                  我正在尝试为此部分实现平面层次结构,并希望有一个分段控制器,但我无法使分段控制器看起来像我想要的任何东西,因此我尝试使用导航控制器.

                  I'm trying to implement a flat hierarchy for this section and would like to have a segmented controller but I can't make the segmented controller look anything liked I want, hence why I'm trying to use the navigation controller.

                  当一个按钮被点击时,我执行了这段代码:

                  When a button is clicked I executed this code:

                  [[self navigationController] popViewControllerAnimated:YES];
                          MapsViewController *aViewController = [[MapsViewController alloc]
                                                                 initWithNibName:@"MapsViewController" bundle:nil];
                  [self.navigationController pushViewController:aViewController animated:NO];
                  [aViewController release];
                  

                  它弹出正常,但没有任何推动的迹象!任何帮助将不胜感激.

                  It's popping off ok but theres no sign of any pushing! Any help would be appreciated.

                  推荐答案

                   MapsViewController *aViewController = [[MapsViewController alloc]
                                                          initWithNibName:@"MapsViewController" bundle:nil];
                       // locally store the navigation controller since
                       // self.navigationController will be nil once we are popped
                   UINavigationController *navController = self.navigationController;
                  
                       // retain ourselves so that the controller will still exist once it's popped off
                   [[self retain] autorelease];
                  
                       // Pop this controller and replace with another
                   [navController popViewControllerAnimated:NO];//not to see pop
                  
                   [navController pushViewController:aViewController animated:YES];//to see push or u can change it to not to see.
                  

                  或者

                   MapsViewController *aViewController = [[MapsViewController alloc]
                                                          initWithNibName:@"MapsViewController" bundle:nil];
                  
                  
                  UINavigationController *navController = self.navigationController;
                  
                  //Get all view controllers in navigation controller currently
                  NSMutableArray *controllers=[[NSMutableArray alloc] initWithArray:navController.viewControllers] ;
                  
                  //Remove the last view controller
                  [controllers removeLastObject];
                  
                  //set the new set of view controllers
                  [navController setViewControllers:controllers];
                  
                  //Push a new view controller
                  [navController pushViewController:aViewController animated:YES];
                  

                  这篇关于以相同的动作弹出和推送视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么我的 SwiftUI 应用程序在 `NavigationView` 中的 `navigationBarItems` 下一篇:你如何在 UIBarItem 中使用 setTitleTextAttributes:forState?

                  相关文章

                1. <legend id='Zb4zq'><style id='Zb4zq'><dir id='Zb4zq'><q id='Zb4zq'></q></dir></style></legend>
                    <tfoot id='Zb4zq'></tfoot>
                    <i id='Zb4zq'><tr id='Zb4zq'><dt id='Zb4zq'><q id='Zb4zq'><span id='Zb4zq'><b id='Zb4zq'><form id='Zb4zq'><ins id='Zb4zq'></ins><ul id='Zb4zq'></ul><sub id='Zb4zq'></sub></form><legend id='Zb4zq'></legend><bdo id='Zb4zq'><pre id='Zb4zq'><center id='Zb4zq'></center></pre></bdo></b><th id='Zb4zq'></th></span></q></dt></tr></i><div id='Zb4zq'><tfoot id='Zb4zq'></tfoot><dl id='Zb4zq'><fieldset id='Zb4zq'></fieldset></dl></div>
                  1. <small id='Zb4zq'></small><noframes id='Zb4zq'>

                    • <bdo id='Zb4zq'></bdo><ul id='Zb4zq'></ul>