UItextfiled how to make border radius and keep shadow border also radius

I have text files and I want to change its radius, the text field has correctly adopted the radius, but the border looks like a cut.

How can I make the border also a radius? see below image

enter image description here

+5
source share
1 answer

You can use this code. He works with me.

UITextField* txtfield = [[UITextField alloc]initWithFrame:CGRectMake(10, 50, 300, 32)];
[txtfield setBorderStyle:UITextBorderStyleNone];
txtfield.layer.cornerRadius = 15.0;
txtfield.layer.borderWidth = 2.0;
txtfield.layer.borderColor = [UIColor redColor].CGColor;
txtfield.layer.masksToBounds = YES;
[self.view addSubview:txtfield];

Set the background in your view and set borderColor to clearColor

+15
source

All Articles