在iOS 7上双击带有搜索委托的UISearchBar会导致UISearchBar消失 [英] Double tap UISearchBar with search delegate on iOS 7 causes UISearchBar to disappear

查看:119
本文介绍了在iOS 7上双击带有搜索委托的UISearchBar会导致UISearchBar消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在表格标题中有一个搜索栏。当用户在iOS 7上快速点击两次时,它会消失。有没有人有任何建议我们做错了什么?

We have a search bar in the table header. When the user taps on it twice quickly on iOS 7, it disappears. Does anyone have any suggestions what we are doing wrong?

推荐答案

经过大量试验和错误,我发现当searchDisplayController结束搜索时,搜索栏消失,所以我已经将搜索栏重新插入到表头,它对我有效。

After lots of trial and errors, I found that when searchDisplayController ends search, searchbar gets disappear, so I have reinserted the searchbar to table header and it worked for me.

- (void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller
{
    self.searchingFetchedResultsController = nil;
    if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
        [self.tableView insertSubview:self.searchDisplayController.searchBar aboveSubview:self.tableView];
    }
    return;
}

希望这有帮助。

这篇关于在iOS 7上双击带有搜索委托的UISearchBar会导致UISearchBar消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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