【问题标题】:UISearchDisplayController CGContext Error iOS 7UISearchDisplayController CGContext错误iOS 7
【发布时间】:2013-12-01 15:48:35
【问题描述】:

我在我的应用程序中使用 UISearchDisplayController。由于 iOS 7 出现了一个奇怪的错误,当单击 searchBar 并显示键盘时,如果用户决定在“searchField”为空时再次单击 searchBar,则应用程序会出现几个错误。

这个问题在这个帖子中讨论:UISearchBar CGContext ERROR

现在我有两个问题:有什么办法可以解决这个问题吗?如果没有,您可以将应用程序上传到系统中带有此错误的 App Store 吗?

问候

我的代码:

- (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;
}

【问题讨论】:

    标签: ios ios7 uisearchbar cgcontext uisearchdisplaycontroller


    【解决方案1】:

    您可以在出现该错误的情况下发布您的应用,因为它不会使您的应用崩溃,而且这是一个框架错误。请勿尝试修复此问题,因为您会尝试修复根本不会损害您的应用的内容。

    此外,由于已经提交了有关此问题的错误报告,您可以放心,该问题将很快得到解决。

    【讨论】:

    • 感谢您的回复。我在其他地方也发现了这个,在 TextField 中也是如此。我敢打赌,很多人在他们的应用程序中都有这个而不知道它!我会把它上传到商店然后:=)
    • 是的,当然,我也将发布我的应用程序并出现错误。
    【解决方案2】:
            - (BOOL)searchDisplayController:(UISearchDisplayController *)controller 
                    shouldReloadTableForSearchString:(NSString *)searchString{
                  }
    

    如果大于iOS7则设置frame

    我没有看到你在使用这个

       - (void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)
                controller {
                [self.searchDisplayController.searchResultsTableView setDelegate:self];
                 }
    

    【讨论】:

    • 抱歉没有解决问题:(
    猜你喜欢
    • 1970-01-01
    • 2014-02-09
    • 2013-09-30
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    • 1970-01-01
    • 2014-02-23
    • 1970-01-01
    相关资源
    最近更新 更多