获取UISearchBar上的UITextField

UITextField *searchField = [_searchBar valueForKey:@"_searchField"];
//获取只需要上面一句话
    searchField.tag = 100;
    searchField.textColor = fontBlackColor;
    searchField.backgroundColor = Bg_Grey;
    [searchField setLeftViewMode:UITextFieldViewModeNever];
    [searchField setRightViewMode:UITextFieldViewModeNever];
    [searchField setValue:fontGreyColor forKeyPath:@"_placeholderLabel.textColor"];
    [searchField becomeFirstResponder];
[searchField setValue:[UIFont systemFontOfSize:12]forKeyPath:@"_placeholderLabel.font"];
        [searchField setBorderStyle:UITextBorderStyleNone];
        searchField.layer.borderWidth = 3.0f;
        searchField.layer.cornerRadius = 10.0f;
        searchField.layer.borderColor = [UIColor clearColor].CGColor;
        searchField.clearButtonMode=UITextFieldViewModeNever;

 

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!
技术狗 » 获取UISearchBar上的UITextField