i am trying to learn iOS developing, but i using
+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha
I always not getting the right number, it always like something missing..
Please help..
here is my code:
[UIColor colorWithRed:65/255 green:62/255 blue:125/255 alpha:1.0];
easy...
you simply need to add .0 at the end of each number, like this:
[UIColor colorWithRed:65.0/255.0 green:62.0/255.0 blue:125.0/255.0 alpha:1.0];
since they need Float value instead of int.
Use this and add .0f after each parameter
[UIColor colorWithRed:65.0f/255.0f green:62.0f/255.0f blue:125.0f/255.0f alpha:1.0f];
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