senthil.Freelancer senthil.Freelancer - 3 months ago 12
iOS Question

How to convert UIColor value to a named color string?

I need to convert

UIColor
to an
NSString
of the color name.

I tried:

NSString *colorString = NSStringFromClass([[UIColor redColor] class]);


But
colorString
did not give @"redColor".

Answer

What do you want to do that for? Have a look at generic -desciption method for a start

UIColor* someColor = ...//Initialize color
NSString* colorString = [someColor description];