UIButton *button = [textField valueForKey:@"_clearButton"];
[button setImage:[UIImage imageNamed:@"icon_blueclear"] forState:UIControlStateNormal];
field.clearButtonMode = UITextFieldViewModeWhileEditing;
- (BOOL)textFieldShouldClear:(UITextField *)textField
{
//返回一个BOOL值指明是否允许根据用户请求清除内容
//可以设置在特定条件下才允许清除内容
_searchTableView.hidden= YES;
[self.view endEditing:YES];
[self.searchTF resignFirstResponder];
return YES;
}
网友评论