NavigationItem iOS 11 Apple 方式中的 UISearchController [英] UISearchController in NavigationItem iOS 11 Apple way

查看:16
本文介绍了NavigationItem iOS 11 Apple 方式中的 UISearchController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS 11 中,Apple 提供了新的搜索栏,但在 iOS 11.2.2 中,当两个视图控制器都有 searchController 时,开发人员会出现 pushpop 动画错误.Apple 在文件应用程序中展示了他们的愿景.有人知道怎么做吗?

In iOS 11 Apple presented new search bar, but yet in iOS 11.2.2 developer have pushpop animation bug when both view controllers have searchController. Apple demonstrate their vision in Files app. Do someone know how do it?

编辑#1

动画损坏的问题.

你可以在 ViewController 中添加一些代码 -viewDidLoad 一些代码行用于导航栏中的搜索栏

you can add some line of code in ViewController -viewDidLoad some line of code for search bar in navigation bar

self.navigationController?.navigationBar.prefersLargeTitles = true
self.navigationItem.largeTitleDisplayMode = .automatic
let search = UISearchController(searchResultsController: nil) // Declare the searchController
self.navigationItem.searchController = search

这篇关于NavigationItem iOS 11 Apple 方式中的 UISearchController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆