iOS 11搜索栏平滑消失

Nic*_*voz 7 ios searchbar swift ios11

我遇到了一个小问题,我在我的应用程序中实现了新的iOS 11的样式搜索栏,我注意到它消失的动画与消息中的动画略有不同.它更快,更不平滑.

有没有人偶然发现这个"问题"?

这是我使用的代码:

searchController.searchResultsUpdater = self
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.delegate = self

if #available(iOS 11.0, *) {
    navigationItem.searchController = searchController
} else {
    tableView.tableHeaderView = searchController.searchBar
    searchController.searchBar.barTintColor = .white
    searchController.searchBar.layer.borderColor = UIColor.white.cgColor
    searchController.searchBar.layer.borderWidth = 1
}
definesPresentationContext = true
searchController.searchBar.placeholder = "all_search".localized
Run Code Online (Sandbox Code Playgroud)

编辑: 在此输入图像描述

我不知道它是否会对你有所帮助,但我正在以正常的速度滚动.谢谢

小智 -1

UIView.animate(withDuration: 1, animations: { 
//your codes to implement
}, completion: nil)
Run Code Online (Sandbox Code Playgroud)

更改持续时间:以秒为单位