How do I set a UITextField's borderColor? How do I set a UITextField's borderColor? ios ios

How do I set a UITextField's borderColor?


@coderRed gave you an Objective C answer and a Swift answer. Ignore his first Line

I broke it up into 2 statements below in Swift:

let myColor : UIColor = UIColor( red: 0.5, green: 0.5, blue:0, alpha: 1.0 )myTextField.layer.borderColor = myColor.CGColor

Hope this helps! Good luck with learning Swift


You can try this,it works for me

myTextField.layer.cornerRadius = 8.0myTextField.layer.masksToBounds = truemyTextField.layer.borderColor = UIColor( red: 153/255, green: 153/255, blue:0/255, alpha: 1.0 ).CGColormyTextField.layer.borderWidth = 2.0


Try this:

myTextField.layer.borderColor = [UIColor blackColor].CGColor;myTextField.layer.borderColor = (UIColor( red: 0.5, green: 0.5, blue:0, alpha: 1.0 )).CGColor;


matomo