Sarabyte Studios
Sarabyte Studios

Reputation: 1336

How to get the name of a UIColor?

I have an array of UIColors like

[UIColor blueColor];

is it possible to get the name "blue" from that UIColor, to display it in a string?

Upvotes: 1

Views: 1924

Answers (3)

thundertrick
thundertrick

Reputation: 1674

A list of color names can be obtained using runtime. See my question: How to get all Color methods of UIColor?

You can also use string methods to convert 'xxxColor' to 'xxx' if needed.

Upvotes: 0

Burhanuddin Sunelwala
Burhanuddin Sunelwala

Reputation: 5343

You can get RGB and Alpha of the UIColor, if you want.

Upvotes: 0

Becca Royal-Gordon
Becca Royal-Gordon

Reputation: 17861

There's nothing built in to UIKit, but Erica Sadun's uicolor-utilities library adds similar functionality.

Upvotes: 2

Related Questions