I am trying to set a UITextField
's borderColor
in iOS 8 in Swift. I tried using this code:
myTextField.layer.borderColor = UIColor( red: 0.5, green: 0.5, blue:0, alpha: 1.0 )
I got this error:
UIColor not convertible to CGColor
@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
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