English 中文(简体)
UISearchDisplayController取消按钮不刷新标题和索引
原标题:UISearchDisplayController cancel button not refreshing headers and index

I have a table view, with a long list of strings. There are headers for each section, an index along the right hand side, and a search button. This has been implemented programmatically, using a UISearchDisplayController, (i.e. not in IB).

When the search button is activated, I hide the headers (in titleForHeaderInSection), and hide the index (in sectionIndexTitlesForTableView), by asking
if ([self.searchDisplayController isActive])

问题是,当单击取消按钮时,标题和索引起初保持隐藏状态。我尝试(在searchBarCancelButtonClicked中)调用[self.tableView reloadData],但不起作用。

我的viewWillAppear中有一个[self.tableView reloadData],这在某种程度上有帮助:如果我选择一行,将另一个视图推到堆栈上,然后返回到此表,则标题和索引会按需显示。

我可能做错了什么?

最佳回答

我发现,有时,当[tableView reloadData]不起作用时,这样做会:

[tableView performSelector:@selector(reloadData) withObject:nil afterDelay:0];

无论出于何种原因,有时表视图会进入这样一种状态,即必须等到运行循环的下一次迭代后,重新加载才会生效。

问题回答

暂无回答




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签