按照微信的搜索框自己写了一个UISearchControllerDeme,WeChatSearchController 最近需要做一个搜索效果和微信搜索页面很类似,我使用UISearchController尝试了很多办法,都不能默认显示searchResultController,经过翻墙查找海量资料,终于做成微信的搜索效果,需要设置的地方只有下面一个地方:
#pragma mark - UISearchResultsUpdating
//每输入一个字符都会执行一次
- (void)updateSearchResultsForSearchController:(UISearchController *)searchController{
searchController.searchResultsController.view.hidden = NO;
}
就这句,让 searchResultsController 一直显示:
searchController.searchResultsController.view.hidden = NO;
如果小伙伴们喜欢,请为我打call!star!么了个哒~