UItableVIEwController *searchResultsController = [[UItableVIEwController alloc] initWithStyle:UItableVIEwStylePlain]; searchResultsController.tableVIEw.dataSource = self; searchResultsController.tableVIEw.delegate = self; searchResultsController.tableVIEw.backgroundcolor = [UIcolor redcolor]; self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController]; self.searchController.delegate = self; self.searchController.searchResultsUpdater = self; self.searchController.dimsBackgroundDuringPresentation = YES; self.searchController.hIDesNavigationbarDuringPresentation = NO; [self.searchController.searchbar sizetoFit]; self.tableVIEw.tableheaderVIEw = self.searchController.searchbar; self.definesPresentationContext = NO;
这是我开始输入后的结果:
注意表格视图是如何存在的,但它似乎占据了导航控制器的空间并向下延伸到第一部分标题中.有任何想法吗?
谢谢.
解决方法 您需要将definesPresentationContext设置为YES.从苹果例子:// Search is Now just presenting a vIEw controller. As such,normal vIEw controller// presentation semantics apply. namely that presentation will walk up the vIEw controller// hIErarchy until it finds the root vIEw controller or one that defines a presentation context.self.definesPresentationContext = YES总结
以上是内存溢出为你收集整理的uitableview – 在UISearchController文本字段中键入时,导航栏消失全部内容,希望文章能够帮你解决uitableview – 在UISearchController文本字段中键入时,导航栏消失所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)