【发布时间】:2018-06-04 20:24:45
【问题描述】:
在一些主要是 6s 的设备类型中,UISearchController 没有完全跨越。
//Init search controller
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
UISearchBar *searchBar = self.searchController.searchBar;
searchBar.frame = self.searchBarHolder.bounds;
self.searchController.searchResultsUpdater = self;
self.searchController.delegate= self;
self.searchController.searchBar.delegate=self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
[self.searchBarHolder addSubview:searchBar];
[self.searchBarHolder layoutIfNeeded];
[searchBar sizeToFit];
searchBarHolder 在情节提要中设置,约束为trailing-0, top-0, leading-0, height - 45
这会产生以下结果:
一旦点击搜索栏,它就会出现becomeFirstResponder,然后,它就会正确显示。
我不知道为什么它一开始会这样显示。
这个UIViewController 嵌入在UINavigationCOntroller 中,并且它作为选项卡项之一嵌入在UITabBarController 中。
【问题讨论】:
-
“取消”按钮是否出现过?
-
是的,点击搜索栏时会出现。
标签: ios objective-c uisearchcontroller