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

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

        使用 UISearchController 时,iOS 13 UIBarButtonItem 不可点击且 UINavig

        时间:2023-05-17
      3. <tfoot id='nDP4u'></tfoot>
        <i id='nDP4u'><tr id='nDP4u'><dt id='nDP4u'><q id='nDP4u'><span id='nDP4u'><b id='nDP4u'><form id='nDP4u'><ins id='nDP4u'></ins><ul id='nDP4u'></ul><sub id='nDP4u'></sub></form><legend id='nDP4u'></legend><bdo id='nDP4u'><pre id='nDP4u'><center id='nDP4u'></center></pre></bdo></b><th id='nDP4u'></th></span></q></dt></tr></i><div id='nDP4u'><tfoot id='nDP4u'></tfoot><dl id='nDP4u'><fieldset id='nDP4u'></fieldset></dl></div>

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

              <tbody id='nDP4u'></tbody>

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

                  <legend id='nDP4u'><style id='nDP4u'><dir id='nDP4u'><q id='nDP4u'></q></dir></style></legend>
                • 本文介绍了使用 UISearchController 时,iOS 13 UIBarButtonItem 不可点击且 UINavigationBars 重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个导航栏,其中包含一些 UIBarButtonItem 按钮和一个 UISearchBar 像这样连接

                  var searchController: UISearchController!覆盖 func viewDidLoad() {super.viewDidLoad()标题=测试"tableView.delegate = 自我tableView.dataSource = 自我searchController = UISearchController(searchResultsController: nil)导航项.searchController = 搜索控制器//这会导致错误searchController.hidesNavigationBarDuringPresentation = falsenavigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(leftTapped))navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(rightTapped))}

                  场景:我点击搜索栏,然后点击取消.

                  • 问题 1:条形按钮对触摸没有反应,除非我触摸屏幕的最外层像素(只有通过模拟器和鼠标点击才有可能).

                  • 问题 2:当我推送另一个视图控制器时,导航项重叠.

                  当我使用 hidesNavigationBarDuringPresentation = true 时,它按预期工作.

                  <小时>

                  该问题出现在使用 Xcode 11.0 和 11.1 的缺口和非缺口 iPhone iOS 13.0 和 13.1 上.

                  这是整个测试项目:

                  这是之后的样子:

                  两个副本视图和额外的 UILabel 是问题所在.我不知道他们在那里做什么,也找不到删除它们的方法.

                  编辑顺便说一句,我认为 Apple 的一些应用程序显示了相同的错误.更容易查看您是否有大标题,因为这样您就可以同时看到大标题和额外标签:

                  I got a navigation bar containing some UIBarButtonItem buttons and a UISearchBar hooked up like this

                  var searchController: UISearchController!
                  
                  override func viewDidLoad() {
                      super.viewDidLoad()
                  
                      title = "Test"
                  
                      tableView.delegate = self
                      tableView.dataSource = self
                  
                      searchController = UISearchController(searchResultsController: nil)
                      navigationItem.searchController = searchController
                  
                      // This leads to the bug
                      searchController.hidesNavigationBarDuringPresentation = false
                  
                      navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(leftTapped))
                      navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(rightTapped))
                  }
                  

                  Scenario: I tap into the search bar and tap cancel afterwards.

                  • Issue 1: The bar buttons are not reacting to touch except when I touch the outer most pixels of the screen (only possible with the simulator and mouse clicks).

                  • Issue 2: The navigation items are overlapping when I push another view controller.

                  When I use hidesNavigationBarDuringPresentation = true it's working like expected.


                  The issue appears on notched and non-notched iPhones iOS 13.0 and 13.1 using Xcode 11.0 and 11.1.

                  Here's the whole test project: https://github.com/fl034/HidesNavigationBarDuringPresentationTest


                  I've filed a radar (and you should too), but maybe some of you guys have already a workaround for it?


                  Update 1: Bug is still there in iOS 13.1.1


                  Update 2: Bug is fixed in iOS 13.2 beta (thanks @Ben Gomm)

                  解决方案

                  The view debugger reveals what's going on with this bug. The contents of the navigation bar are being copied. Here's what the navigation bar looks like before you show the search:

                  And here's what it looks like afterwards:

                  The two replicant views and the extra UILabel are the problem. I don't know what they're doing there and I can't find a way to remove them.

                  EDIT By the way, I think some of Apple's apps display the same bug. It's easier to see if you have large titles, because then you can see the large title and the extra label at the same time:

                  这篇关于使用 UISearchController 时,iOS 13 UIBarButtonItem 不可点击且 UINavigationBars 重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何防止状态栏与 UINavigationController 上设置的 hidesBarsOnSwipe 内容重叠? 下一篇:iOS 11 navigationItem.titleView 宽度未设置

                  相关文章

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

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

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