I am trying to set the textColor
of a UITextView
by assigning it a value.
Earlier in the program I have
textView.textColor = 0x000000;
but later, when I have
textView.textColor = 0x888888;
a fatal error pops up saying: "Implicit conversion of 'int' to 'UIColor *' is disallowed with ARC".
How do I convert my int to a UIColor to properly set the text color? Why did it work with 0x000000 and not 0x888888?
as par you submited answer this is not an answer UIColorFromRGB
is a Macro that define above at @implementation
like
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0];
Then you can use like
textView.textColor = UIColorFromRGB(0x888888);
you can use its property of UIColor
for setting color of text bg-color etc in objective c
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