How to hide UITextField border?

I have a UITextField and I am trying to make the UITextField border invisible so that the background and UITextField would have the same color and there would be a seamless look. But the problem is I also use a placeholder and there is a border that I cannot remove. I already tried:

textOption.borderStyle = UITextBorderStyleNone;
textOption.layer.borderWidth = 0;

It didn't work. Would you please help me on that? I still can see the border of the UITextField. fyi: The UITextView that I use doesn't have this issue => There is no placeholder in UITextViews.


If you want to remove the textfield border you can do it directly with interface builder: enter image description here


Just use this..

textOption.borderStyle = UITextBorderStyleNone;
[textOption setBackgroundColor:[UIColor clearColor]];

Swift 4 and 5 :

yourTextfield.borderStyle = .none

In Swift this worked for me :

 passwordTextField.borderStyle = UITextBorderStyle.none