搜索支持空搜索

  • (void)searchBarTextDidBeginEditing:(UISearchBar *) searchBar
    {
    UITextField *searchBarTextField = nil;
    NSArray *views = ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0) ? searchBar.subviews : [[searchBar.subviews objectAtIndex:0] subviews];
    for (UIView *subview in views)
    {
    if ([subview isKindOfClass:[UITextField class]])
    {
    searchBarTextField = (UITextField *)subview;
    break;
    }
    }
    searchBarTextField.enablesReturnKeyAutomatically = NO;
    }

你可能感兴趣的:(搜索支持空搜索)