Malav Soni Malav Soni - 28 days ago 7
Swift Question

TextField Corner Radius : Not Sharp Corners

I am trying to add corner radius on uitextfield effect applies but not sharp corner.

Please check attached pictures.enter image description here

I am expecting result like this. enter image description here

Here is my Code for gray textfield.

self.layer.cornerRadius = 7.5
self.layer.borderWidth = 1.5
self.layer.borderColor = UIColor(red: 209/255.0, green: 209/255.0, blue: 209/255.0, alpha: 1.0).CGColor
self.backgroundColor = UIColor.whiteColor()


Here is my Code for Red textfield.

self.layer.cornerRadius = 7.5
self.layer.borderWidth = 1.5
self.layer.borderColor = TextFieldRedBorderColor.CGColor
self.backgroundColor = TextFieldRedBackgroundColor


There is only color difference between both code but still it's not working.

Answer

There was just one mistake in my code.

TextField Border Style Was Line

textField.borderStyle = .Line

then I make it None

textField.borderStyle = .None

and it work like I wanted (Rounded Corners)...

Anyway.. Thanks for support and answers...