I have a UITextField in which I want to display a clear button. The UITextField's cornerRadius has been modified and has no border. I have also added padding to the left and right of the text area. The following code leaves me with no clear button.
searchField.layer.cornerRadius = 15; searchField.clearButtonMode = UITextFieldViewModeAlways; UIView *padding = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 20)]; searchField.leftView = padding; searchField.leftViewMode = UITextFieldViewModeAlways; searchField.rightView = padding; searchField.rightViewMode = UITextFieldViewModeAlways; [padding release]; [searchField addTarget:self action:@selector(textFieldDidChange) forControlEvents:UIControlEventEditingChanged]; searchField.userInteractionEnabled = YES; Does anyone know why I'm unable to get the button to show? I'd appreciate any help.
Thanks!