ios - 激活 UISearchController,导航推送时不带动画

标签 ios uisearchcontroller

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/

相关文章:

ios - 如何在 iOS 上使用 libtiff 编写 1bpp tiff?

ios - 删除/插入文本后,UITextView向上滚动

ios - 如何快速删除附加的搜索元素

swift - swift 2.0 中过滤方法的第二个参数

ios - UISearchController 中的 SearchBar 委托(delegate)不起作用

xcode - 无效的权利 iOS SDK 4.1

ios - UITableViewCell 附件未随 searchResults 更新

ios - 如何在聚焦时调整 UISearchController.searchBar 的大小问题?

ios - 按搜索后搜索栏消失

ios - 如果用户停止说话,如何自动停止语音识别