Same as Adding the "Clear" Button to an iPhone UITextField but that one is old. I tried
myUITextField.clearButtonMode = UITextFieldViewModeWhileEditing;
but nothing is happening. What could be preventing it?
Same as Adding the "Clear" Button to an iPhone UITextField but that one is old. I tried
myUITextField.clearButtonMode = UITextFieldViewModeWhileEditing;
but nothing is happening. What could be preventing it?
In cellForRowAtIndex, the fix looks like this in my case:
cell = [tableView dequeueReusableCellWithIdentifier:@"CellNameIdentifier"];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"CellName" owner:self options:nil];
cell = cellName;
[cellName setAccessoryType:UITableViewCellAccessoryNone];
//textfield in inside cellName
textfield.clearButtonMode = UITextFieldViewModeWhileEditing;
}
In some situations the UITextField height and alignment can cause the clear button to be hidden below the cell even though your text input displays fine.
Double check your height or try this :
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;