iOS 13 strange search controller gap

前端 未结 12 1755
无人共我
无人共我 2021-02-01 14:55

When running the App on iOS 13 beta 6, using Xcode 11 beta 5 I\'m encountering the strange gap when presenting search results view controller:

Here\'s a bit o

12条回答
  •  长发绾君心
    2021-02-01 15:42

    Using .asyncAfter(deadline: .now() + 0.1) will cause a glitch in the UI. To get rid of that, get rid of the deadline! Using DispatchQueue.main.async is enough.

    extension UISearchController {
        open override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
            if let presentingVC = self.presentingViewController {
                DispatchQueue.main.async {
                    self.view.frame = presentingVC.view.frame
                }
            }
        }
    }
    

提交回复
热议问题