<tfoot id='QF1pK'></tfoot>

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

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

    2. <i id='QF1pK'><tr id='QF1pK'><dt id='QF1pK'><q id='QF1pK'><span id='QF1pK'><b id='QF1pK'><form id='QF1pK'><ins id='QF1pK'></ins><ul id='QF1pK'></ul><sub id='QF1pK'></sub></form><legend id='QF1pK'></legend><bdo id='QF1pK'><pre id='QF1pK'><center id='QF1pK'></center></pre></bdo></b><th id='QF1pK'></th></span></q></dt></tr></i><div id='QF1pK'><tfoot id='QF1pK'></tfoot><dl id='QF1pK'><fieldset id='QF1pK'></fieldset></dl></div>
      1. UINavigationController每一页的UIToolbar

        时间:2023-06-11
        <tfoot id='0IDWl'></tfoot>
          <tbody id='0IDWl'></tbody>
          • <legend id='0IDWl'><style id='0IDWl'><dir id='0IDWl'><q id='0IDWl'></q></dir></style></legend>

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

              <bdo id='0IDWl'></bdo><ul id='0IDWl'></ul>

                  本文介绍了UINavigationController每一页的UIToolbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个在 UINavigationController 上运行的应用程序.现在我想在每个屏幕的底部添加一个 UIToolbar 元素.底部的工具栏应该可以针对当前显示的 ViewController 进行自定义.我的第一个想法是简单地将工具栏添加到 navigationController 视图并标记它,在 viewController 中我认为我可以检索 UIToolbar 元素.我有以下代码:

                  I have an application which runs on a UINavigationController. Now I would like to add a UIToolbar element to the bottom of each screen. The Toolbar on the bottom should the be customizable for the ViewController that is currently being displayed. My first idea was to simply add the toolbar to the navigationController view and tag it, in the viewController I thought I would then be able to retrieve the UIToolbar element. I have the following code:

                  在我的 AppDelegate 中:

                  In my AppDelegate:

                  // Get instance of Toolbar  (navController is an instance of UINavigationController and TOOLBAR_TAG a constant)
                  UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 440, 320, 40)];
                  toolbar.tag = TOOLBAR_TAG;
                  [navController.view addSubview:toolbar];
                  

                  在我的 viewController 我试过这个:

                  In my viewController I tried this:

                  UIToolbar *toolbar = [self.navigationController.view viewWithTag:TOOLBAR_TAG];
                  toolbar.barStyle = UIBarStyleBlack;
                  

                  但这给了我一个错误,说我的工具栏是UILayoutContainerView"对象,而不是 UIToolbar 对象.因此,这个想法似乎是一个死胡同.

                  Yet this gives me an error saying that toolbar in my case is a "UILayoutContainerView" object, not an UIToolbar object. Hence this idea seems to be a dead end.

                  其他人是如何解决这个问题的?

                  How did others solve this issue?

                  推荐答案

                  UINavigationController 已经有了工具栏.只需使用

                  UINavigationController already has a toolbar. Just use

                  [self.navigationController setToolbarHidden:NO];
                  

                  在最顶层的视图控制器和

                  in the topmost view controller and

                  [self setToolbarItems:items];
                  

                  在所有视图控制器中,其中 items 是该视图控制器工具栏项的 NSArray.

                  in all your view controllers, where items is an NSArray of that view controller's toolbar items.

                  至于为什么您的解决方案不起作用:您的 TOOLBAR_TAG 可能不是唯一的,这就是您获得另一个子视图的原因.但正如我所说,无论如何你都应该使用附带的工具栏.

                  As for why your solution isn't working: your TOOLBAR_TAG is probably not unique, that's why you're getting another subview. But as I said, you should use the included toolbar anyway.

                  这篇关于UINavigationController每一页的UIToolbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:弹出到根视图控制器,没有表视图的动画崩溃 下一篇:使用 UIPageViewController 时如何将 UIBarButtonItem 添加到 NavigationB

                  相关文章

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

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

                    <tfoot id='JGKq0'></tfoot>

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