how to set uitextfield and UITextView
border color programmatically , when we enter or edit in textfield and textview.
I used this code, but doesn't change the border color for the UITextView
.
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
textField.layer.borderColor=[[UIColor cyanColor] CGColor];
}
Don't Forget : #Import <QuartzCore/QuartzCore.h>
Working Code :
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
textField.layer.cornerRadius=8.0f;
textField.layer.masksToBounds=YES;
textField.layer.borderColor=[[UIColor redColor]CGColor];
textField.layer.borderWidth= 1.0f;
return YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With