I want to remove the border of UITextField dynamically.
I tried [stringTextField setBorderStyle:UITextBorderStyleNone];
but nothing happened. Any idea?
Is the TextField
already displayed in the view when this happens? If so, you (probably) need to execute the following:
[stringTextField setBorderStyle:UITextBorderStyleNone];
[stringTextField setNeedsDisplay];
in order for the view to redraw the TextField
, sans border. Note that there's no guarantee the system will immediately redraw the textField
. You're indicating to the system that you'd like the field to be redrawn.
With an existing UITextField I found that this worked:
[textField setEnabled:NO];
[textField setBorderStyle:UITextBorderStyleNone];
while this did not (the border remained in the view):
[textField setBorderStyle:UITextBorderStyleNone];
[textField setEnabled:NO];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With