与UISearchBar \ UISearchDisplayViewController发生故障 [英] Troubles with UISearchBar \ UISearchDisplayViewController
问题描述
我在iOS 7上使用SearchDisplayViewController很难。
我在UITableViewController上隐藏了一个searchBar,比如
I'm having a hard time with my SearchDisplayViewController on iOS 7. I have a searchBar hidden over a UITableViewController, like
self.tableView.tableHeaderView = searchBar;
问题是,当我点击searchBar输入内容时,视图开始变灰,然后我在一个随机点上快速点击屏幕以关闭它,回到tableView,searchBar消失了。完全。仅在iOS 7上。
Problem is that when I tap on the searchBar to type in something, then the view starts greying out, and I quickly tap the screen in a random point to dismiss it, coming back to the tableView, the searchBar disappears. Totally. Only on iOS 7 though.
调试它,帧始终相同:0,0,320,44。但酒吧是看不见的!
Debugging it, the frame is always the same: 0,0,320,44. But the bar is invisible!
还试图做
self.tableView.contentOffset = CGPointMake(0,self.searchDisplayController.searchBar.frame.size.height);
当我快速完成时仍然会消失。
still disappears when I do it quickly.
在iOS 6上它运行得很好。问题只出现在我看到的iOS 7上。
On iOS 6 it works just fine. Problem is only with iOS 7 as far as I'm seeing.
我不知道它取决于什么,有没有人遇到过同样的问题?
I don't know what it depends on, has anyone encountered the same problem I have?
推荐答案
从在iOS 7上用搜索委托双击UISearchBar导致UISearchBar消失,我发现实际工作的解决方法并解决了错误 - 对于现在
As of Double tap UISearchBar with search delegate on iOS 7 causes UISearchBar to disappear, I found the workaround to actually work and solved the bug - for now.
- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
{
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
[self.tableView insertSubview:self.searchDisplayController.searchBar aboveSubview:self.tableView];
}
}
这篇关于与UISearchBar \ UISearchDisplayViewController发生故障的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!