我在我的应用程序中使用UISearchDisplayController。由于iOS 7出现了一个奇怪的bugg,当searchBar和键盘被显示时,如果用户决定在"searchField“为空时再次使用searchField,则应用程序会出现几个错误。
在这个线程:UISearchBar CGContext ERROR中讨论了bugg。
现在我有两个问题:有没有办法解决tihs问题?如果没有,你能上传应用程序到应用商店与这个bugg在系统中?
问候
我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
if ([self systemVersionGreaterThanOrEqualTo:@"7.0"])
{
[[UISearchBar appearance]setSearchFieldBackgroundImage:[UIImage imageNamed:@"searchbar_bg"] forState:UIControlStateNormal];
self.navigationItem.titleView = searchBar;
}
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {
[self.searchDisplayController setActive:YES animated:NO];
// Hand over control to UISearchDisplayController during the search
// searchBar.delegate = (id <UISearchBarDelegate>)self.searchDisplayController;
return YES;
}
- (void) searchDisplayControllerDidBeginSearch:(UISearchDisplayController
*)controller {
// Un-hide the navigation bar that UISearchDisplayController hid
[self.navigationController setNavigationBarHidden:NO animated:NO];
}
- (void) searchDisplayControllerWillEndSearch:(UISearchDisplayController
*)controller {
searchBar = (UISearchBar *)self.navigationItem.titleView;
// Manually resign search mode
[searchBar resignFirstResponder];
// Take back control of the search bar
searchBar.delegate = self;
}发布于 2013-12-09 10:21:22
您可以发布您的应用程序与该错误发生,因为它不会崩溃您的应用程序,这是一个框架错误。不要试图修复这个问题,因为你想要修复的东西一点也不损害你的应用程序。
此外,由于已经提交了bug报告,您可以放心,该问题将很快得到解决。
发布于 2013-12-04 10:22:06
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString{
}如果它大于iOS7,则设置框架
我看不出你用这个
- (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)
controller {
[self.searchDisplayController.searchResultsTableView setDelegate:self];
}https://stackoverflow.com/questions/20313973
复制相似问题