简体   繁体   English

如何隐藏iOS 11搜索控制器的大标题

[英]How to hide large title iOS 11 search controller

I have set the search controller of my navigation item, so that the search bar is positioned at the top of the screen. 我已设置导航项的搜索控制器,以便搜索栏位于屏幕顶部。 What I want to happen is that the search bar is in the 'title view' position like what used to happen on iOS 10. However, the search bar is moved down to make space for a large title for the view controller. 我想要发生的是搜索栏位于“标题视图”位置,就像在iOS 10上发生的那样。但是,搜索栏向下移动以为视图控制器的大标题腾出空间。 How can I hide this extra space? 我该如何隐藏这个额外的空间?

navigationItem.searchController = searchController

Sorry for a late reply, but try the following 对不起,迟到的回复,但请尝试以下方法

navigationItem.titleView = searchController.searchBar

instead of navigationItem.searchController = searchController . 而不是navigationItem.searchController = searchController Hope it will help! 希望它会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM