<bdo id='5ldr2'></bdo><ul id='5ldr2'></ul>

  • <legend id='5ldr2'><style id='5ldr2'><dir id='5ldr2'><q id='5ldr2'></q></dir></style></legend>
      <tfoot id='5ldr2'></tfoot>

      1. <small id='5ldr2'></small><noframes id='5ldr2'>

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

        在 iOS 7 上,如果最终包含在选项卡栏控制器中,则使用工具栏推送控制器会留下不可用空间的间隙

        时间:2023-06-13

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

              <tbody id='hiHzX'></tbody>

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

                <tfoot id='hiHzX'></tfoot>

                • <bdo id='hiHzX'></bdo><ul id='hiHzX'></ul>
                • 本文介绍了在 iOS 7 上,如果最终包含在选项卡栏控制器中,则使用工具栏推送控制器会留下不可用空间的间隙的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的 iOS 应用程序中,我的窗口的 rootViewController 是一个标签栏控制器,其层次结构如下:

                  In my iOS app, my window's rootViewController is a tab bar controller with the a hierarchy like this:

                  • UITabBarController
                    • UINavigationController 1
                      • 第一内容控制器
                      • ...
                      • ...

                      当用户点击 FirstContentController 上的某一行时,SecondController 的一个实例将被推送到其导航控制器上.SecondContentController 在其 init 方法中将 hidesBottomBarWhenPushed 设置为 YES 并设置 self.navigationController.toolbarHiddenviewWillAppear: 中的 NO.

                      When the user taps a certain row on FirstContentController, an instance of SecondController will be pushed onto its navigation controller. SecondContentController sets hidesBottomBarWhenPushed to YES in its init method and sets self.navigationController.toolbarHidden to NO in viewWillAppear:.

                      在 iOS 6 中,用户将点击 FirstController 中的行,而 SecondController 将被推送到导航控制器上.因为它设置了 hidesBottomBarWhenPushed,所以它会隐藏标签栏,并且在过渡动画完成时,SecondController 会出现在屏幕上,并且其工具栏可见.

                      In iOS 6, the user would tap the row in FirstController and SecondController would get pushed onto the nav controller. Because it has hidesBottomBarWhenPushed set, it would hide the tab bar and, by the time the transition animation was complete, SecondController would be on the screen with its toolbar visible.

                      然而,在 iOS 7 下测试时,hidesBottomBarWhenPushed 的行为似乎发生了变化.我现在看到的是:

                      However, when testing this under iOS 7, hidesBottomBarWhenPushed's behavior seems to have changed. What I see now is:

                      • 标签栏按预期隐藏
                      • 工具栏按预期出现
                      • 工具栏和内容视图之间出现了一个正好 49 像素高(标签栏高度)的不可用空间

                      间隙完全无法使用 - 它不响应触摸,如果我在主视图上将 clipsToBounds 设置为 YES,则不会出现任何内容.经过大量调试和检查子视图层次结构,看起来 iOS 的自动调整大小机制将视图控制器的视图调整为 411 的高度(在 iPhone 5 上).一直到工具栏应该是 460,但布局系统似乎包括一个 49 像素高的幽灵"标签栏.

                      The gap is completely unusable - it doesn't respond to touches and if i set clipsToBounds to YES on the main view, nothing draws there. After a lot of debugging and examining subview hierarchies, it looks like iOS's autosizing mechanism resizes the view controller's view to a height of 411 (on the iPhone 5). It should be 460 to reach all the way down to the toolbar, but the layout system seems to be including a "ghost" 49-pixel-tall tab bar.

                      只有当视图控制器有一个标签栏控制器作为其父容器时才会出现此问题.

                      This problem only occurs if the view controller has a tab bar controller as one if its parent containers.

                      在 iOS 7 上,如何在推送新控制器时让标签栏消失并且工具栏无缝滑入到位,并且仍然让视图占据导航项和工具栏之间的整个空间?

                      On iOS 7, how can I have the tab bar disappear and a toolbar seamlessly slide into place when a new controller is pushed, and still have the view take up the entire space between the navigation item and the toolbar?

                      更新

                      经过进一步调查,只有在 SecondController 的 edgesForExtendedLayout 设置为 UIRectEdgeNone 时才会发生这种情况.但是,除非我将该属性设置为 UIRectEdgeNone,否则视图的框架会太长并延伸到工具栏下方,无法看到或与之交互.

                      After further investigation, this only happens if SecondController's edgesForExtendedLayout is set to UIRectEdgeNone. However, unless I set that property to UIRectEdgeNone, the view's frame is too long and extends under the toolbar, where it can't be seen or interacted with.

                      推荐答案

                      取消选中Hide bottoms bar on push"并设置你的自动约束,就好像有一个标签栏一样.然后在要隐藏系统标签栏的控制器的ViewDidLoad"中,输入以下代码.

                      Uncheck "Hide bottoms bars on push" and set your autoconstraints as if there is a tab bar. Then in "ViewDidLoad" of the controller you want to hide the system tab bar, put the following code.

                      [self.tabBarController.tabBar setFrame:CGRectZero];
                      

                      这确保标签栏仍然接受用户交互但对用户不可见.(其他替代方法,例如将其设置为 0 alpha 或隐藏将呈现标签栏无用)现在自动约束将确保您的视图正确显示,标签栏高度为零.

                      This makes sure the tab bar still accepts user interaction yet not visible to users. (other alternatives such as setting it 0 alpha or hidden will render tab bar useless) Now the autoconstaraints will make sure your view displays correctly with the tab bar height as zero.

                      这篇关于在 iOS 7 上,如果最终包含在选项卡栏控制器中,则使用工具栏推送控制器会留下不可用空间的间隙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Swift 自定义 NavBar 后退按钮图像和文本 下一篇:以流畅的动画显示/隐藏导航栏

                  相关文章

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

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

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

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