
searchbar:(UISearchbar *)searchbar selectedScopebuttonIndexDIDChange:(NSInteger)selectedScope
但它不起作用.我正在使用
-(BOol)searchdisplayController:(UISearchdisplayController *)controller shouldReloadtableForSearchString:(Nsstring *)searchString {// Tells the table data source to reload when text changes[self filterContentForSearchText:searchString scope:[[self.searchdisplayController.searchbar scopebuttonTitles] objectAtIndex:[self.searchdisplayController.searchbar selectedScopebuttonIndex]]];// Return YES to cause the search result table vIEw to be reloaded.return YES; }
-(BOol)searchdisplayController:(UISearchdisplayController *)controller shouldReloadtableForSearchScope:(NSInteger)searchOption {// Tells the table data source to reload when scope bar selection changes[self filterContentForSearchText:self.searchdisplayController.searchbar.text scope:[[self.searchdisplayController.searchbar scopebuttonTitles] objectAtIndex:searchOption]];// Return YES to cause the search result table vIEw to be reloaded.return YES; }
用于文本过滤.我也尝试重新加载数据,它也没有工作.我无法弄清楚为什么在文本更改后tablevIEw更新但在范围栏更改后它没有更新.
解决方法 我解决了这个问题.我不再使用searchdisplayController,而是使用textDIDChange和selectedScopebuttonIndexDIDChange.而不是使用两个表视图(normal和self.searchdisplayController.searchResultstableVIEw)我正在使用单表视图并且我更改其数据源,现在看来这解决了我的问题.但仍然无法弄清楚为什么应该调用divoadtableForSearchScope:不调用cellForRowAtIndexPath:并更新我的表视图 总结以上是内存溢出为你收集整理的ios搜索栏范围按钮不会更新结果tableview全部内容,希望文章能够帮你解决ios搜索栏范围按钮不会更新结果tableview所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)