I have a UITextField in a UITableViewCell. For some reason, the clear button does not match the text textField. Here is my textField code:
cell.selectionStyle = UITableViewCellSelectionStyleNone;
usernameField = [[UITextField alloc] initWithFrame:CGRectMake(22, 10, cell.contentView.frame.size.width, cell.contentView.frame.size.height)];
usernameField.adjustsFontSizeToFitWidth = YES;
usernameField.placeholder = @"Username";
usernameField.backgroundColor = [UIColor clearColor];
usernameField.keyboardType = UIKeyboardTypeDefault;
usernameField.autocapitalizationType = UITextAutocorrectionTypeNo;
usernameField.autocorrectionType = UITextAutocorrectionTypeNo;
usernameField.returnKeyType = UIReturnKeyNext;
usernameField.delegate = self;
usernameField.clearButtonMode = UITextFieldViewModeAlways;
[usernameField setEnabled:YES]
[cell addSubview:usernameField]
[usernameField becomeFirstResponder]
[usernameField release]
And here is a picture to demonstrate the problem:

Edit: I also tried with - (CGRect)clearButtonRectForBounds:(CGRect)boundsand nothing yet
user330885
source
share