UITextField - Rounded corner issue UITextField - Rounded corner issue ios ios

UITextField - Rounded corner issue


Just remove this line...

mobileNumberField.borderStyle = UITextBorderStyleRoundedRect;

and add this code also..

    [mobileNumberField setBackgroundColor:[UIColor whiteColor]];    [mobileNumberField.layer setBorderColor:[UIColor grayColor].CGColor];    [mobileNumberField.layer setBorderWidth:1.0];


Update your like below.

    UITextField *mobileNumberField = [[UITextField alloc] initWithFrame:CGRectMake(10, 195, 300, 41)];    mobileNumberField.delegate = self;    mobileNumberField.layer.borderWidth = 1.0f;    mobileNumberField.layer.borderColor = [UIColor lightGrayColor].CGColor;    mobileNumberField.//    mobileNumberField.borderStyle = UITextBorderStyleRoundedRect;    [mobileNumberField.layer setCornerRadius:14.0f];    mobileNumberField.placeholder = @"Mobile Number";    [self.paymentsHomeView addSubview:mobileNumberField];


textField.layer.cornerRadius=textfield.frame.size.height/2;textField.clipsToBounds=YES;


matomo