Cannot remove border of UITextField dynamically

ios, uitextfield

Solution

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.

Problem

I want to remove the border of UITextField dynamically. I tried `[stringTextField setBorderStyle:UITextBorderStyleNone]; ` but nothing happened. Any idea?

Original source

Related problems