iOS Search bar 输入空字符串也可以搜索

Search bar delegate

iOS Search bar 输入空字符串也可以搜索
- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar
{
    UITextField *searchBarTextField = nil;
    for (UIView *mainview in searchBar.subviews) {
        if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
            if ([mainview isKindOfClass:[UITextField class]]) {
                searchBarTextField = (UITextField *)mainview;
                break;
            }
        }
        for (UIView *subview in mainview.subviews) {
            if ([subview isKindOfClass:[UITextField class]]) {
                searchBarTextField = (UITextField *)subview;
                break;
            }
        }
    }
    searchBarTextField.enablesReturnKeyAutomatically = NO;
}
iOS Search bar 输入空字符串也可以搜索

 

iOS Search bar 输入空字符串也可以搜索,布布扣,bubuko.com

iOS Search bar 输入空字符串也可以搜索

上一篇:使用Jenkins进行android项目的自动构建(4)


下一篇:ios系统声音