Reputation: 463
I v got UITextView, and I want to set it a new custom color like this
var instaColor = UIColor(red: 51, green: 92, blue: 131, alpha: 1).CGColor
textView.layer.borderWidth = 1
textView.layer.cornerRadius = 20
textView.layer.borderColor = instaColor
but its color is white or not appear at all, whats with this? this color should be dark blue + green
Upvotes: 1
Views: 57
Reputation: 193
UIColor requires the color values to be between 0 and 1 so you should change it to:
var instaColor = UIColor(red: 51/255, green: 92/255, blue: 131/255, alpha: 1).CGColor
In the above you are dividing each value by 255 to get the color value to between 0 and 1.
I think your code should work after you do that.
Thanks
Upvotes: 1