在 UISearchDisplayController
有一种方法可以将其设置为事件状态而不使用动画 viewWillAppear:
方法,以便 View Controller 将推送已激活的 UISearchDisplayController
并且已经展示了键盘,这非常好。但现在已弃用。
现在我们有UISearchController
我只能用两个动画来做到这一点:第一个是导航推送,然后是激事件画。我只想看到导航推送动画,并且 searchController 已经激活,搜索栏作为第一响应者并显示键盘。
我试过了
UIView.performWithoutAnimation { () -> Void in
self.searchController.active = true
}
并尝试使用自定义空呈现委托(delegate)方法
func presentSearchController(searchController: UISearchController) {
}
最佳答案
不完全是答案,但是......
我试图通过将.active
设置为false
来关闭UISearchController
,而没有动画和UIView.performWithoutAnimation的提示
成功了
UIView.performWithoutAnimation { // disable the animation as we are going straight to another view
searchController.isActive = false
}
关于ios - 激活 UISearchController,导航推送时不带动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35961142/