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

      <bdo id='kAIq6'></bdo><ul id='kAIq6'></ul>

    1. <tfoot id='kAIq6'></tfoot>

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

      1. 在 UINavigationController 中推送另一个视图?

        Push another View in UINavigationController?(在 UINavigationController 中推送另一个视图?)

            <tfoot id='AMsb1'></tfoot>

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

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

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

                • 本文介绍了在 UINavigationController 中推送另一个视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  如何使用导航控制器中的按钮推送视图?我试着按照这个例子:http://www.cimgf.com/2009/06/25/uitabbarcontroller-with-uinavigationcontroller-using-interface-builder/

                  How to push a view using a button in a navigation controller? I tried to follow this example: http://www.cimgf.com/2009/06/25/uitabbarcontroller-with-uinavigationcontroller-using-interface-builder/

                  这正是我需要的,我有一个带有 4 个选项卡的 UITabBarController,其中一个是 UINavigationController.我想从第一个视图推送包含导航控制器的视图 - 这是一个简单的 UIView.它不起作用,我也尝试使用以编程方式创建的按钮,但没有任何反应.有什么指点吗?

                  This is exactly what I need, I have an UITabBarController with 4 tabs and one of them is an UINavigationController. I want to push that view containing the navigation controller from the first view- which is a simple UIView. It doesn't work, I tried also with a programmatically created button and nothing happens. Any pointers?

                  这是我的代码

                  @interface HomeViewController : UIViewController {
                  
                  }
                  
                  -(IBAction)pushViewController:(id)sender;
                  
                  @end
                  
                  ---
                  
                  #import "HomeViewController.h"
                  #import "NewViewController.h"
                  
                  @implementation HomeViewController
                  
                  -(IBAction)pushViewController:(id)sender {
                          NewViewController *controller = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
                      [[self navigationController] pushViewController:controller animated:YES];
                      [controller release], controller = nil;
                  }
                  

                  这也是连接的屏幕截图http://imageshack.us/photo/my-images/847/screenshot20110719at620.png/

                  我已经尝试了你们的建议,但仍然没有,按钮(无论是在 Interface Builder 中创建还是以编程方式创建)就像它们没有链接到任何方法一样.

                  I've tried what you guys suggested and still nothing, the buttons( whether they are created in Interface Builder or programmatically ) act like they're not linked to any method.

                  推荐答案

                  把这个放在你想创建按钮的地方:(例如Root VC的-viewDidLoad)

                  Put this where you want to create the button: (e.g. the Root VC's -viewDidLoad)

                  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
                  button.frame = CGRectMake(100.0, 100.0, 100.0, 40.0);
                  [button setTitle:@"Press" forState:UIControlStateNormal];
                  [viewController.view addSubview:button];
                  
                  [button addTarget:self action:@selector(didPressButton:) forControlEvents:UIControlEventTouchUpInside];
                  

                  并实现这个方法:

                  - (void)didPressButton:(UIButton *)sender
                  {
                      UIViewController *viewController = [[[UIViewController alloc] init] autorelease];
                      [self.navigationController pushViewController:viewController animated:YES];
                  }
                  

                  这篇关于在 UINavigationController 中推送另一个视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)

                • <tfoot id='OXyBK'></tfoot>

                    • <bdo id='OXyBK'></bdo><ul id='OXyBK'></ul>
                    • <legend id='OXyBK'><style id='OXyBK'><dir id='OXyBK'><q id='OXyBK'></q></dir></style></legend>

                          <tbody id='OXyBK'></tbody>

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

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