TextView borderColor Not Changing

Viewed 72

I am trying to change the borderColor of a textView in Swift. If I set it using a preset color it works fine:

inView.layer.borderColor = UIColor.green.cgColor

However, when I try to set it to a custom RGB value, the borderColor does not change:

inView.layer.borderColor = UIColor.init(red: 100, green: 230, blue: 100, alpha: 1).cgColor
1 Answers

You need to construct color properly ($value/255.0) as color range is from 0 to 1 ( aka 0 to 255/255 )

inView.layer.borderColor = UIColor(red: 100/255.0, green: 230/255.0, blue: 100/255.0, alpha: 1).cgColor
Related