当搜索字符串为空时显示UISearchDisplayTableView [英] Show UISearchDisplayTableView when search string is empty

查看:77
本文介绍了当搜索字符串为空时显示UISearchDisplayTableView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这非常令人沮丧:即使搜索字符串为空,我也试图在UISearchDisplayController中显示未过滤的结果。

This is extremely frustrating: I'm trying to display unfiltered results in a UISearchDisplayController even if the search string is empty.

将调试代码添加到 numberOfSectionsInTableView: numberOfRowsInSection:显示当我的搜索字符串为空时,返回非零整数,但是 cellForRowAtIndexPath:永远不会被调用! tableview似乎是隐藏的。

Adding debug code to numberOfSectionsInTableView: and numberOfRowsInSection: shows that when my search string is empty, non-zero integers are being returned, but cellForRowAtIndexPath: is never called! The tableview appears to be hidden.

我尝试在 tableview.hidden = NO; > searchDisplayController :( UISearchDisplayController *)控制器didHideSearchResultsTableView:(UITableView *)tableView 无济于事。

I tried setting tableview.hidden=NO; in searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView to no avail.

这不可能难以拉动关闭,我想这是一件很常见的事情!

This can't be that hard to pull off, I'd imagine this is a very common thing to do!

推荐答案

那么解决方法就是不要使用UISearchDisplayController。它根本无法提供您做这样的事情所需的灵活性。使用UISegmentedControl,UISearchBar和UITableView构建您自己的自定义搜索界面,以获得最大的灵活性。

Well the solution to this is to not use the UISearchDisplayController. It simply doesn't offer the flexibility you need to do something like this. Build your own custom search interface with a UISegmentedControl, UISearchBar and UITableView for maximum flexibility.

这篇关于当搜索字符串为空时显示UISearchDisplayTableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆