I am using RGB values of a color from Photoshop and using the same in Xcode the values are.Color-R-160,G-97,B-5…the color in Photoshop appears yellowish but in Xcode when I used
myLabel.textColor = [UIColor colorWithRed:160 green:97 blue:5 alpha:1] ;
the color appears whitish.
Why this difference is happening?
Objective-C
You have to give the values between 0 and 1.0. So divide the RGB values by 255.
Update:
You can also use this macro
and you can call in any of your class like this
Swift
This is the normal color synax
Swift is not much friendly with macros
So we use extension for this
You can use it like