Objective C defining UIColor constants

Posted by futureelite7 on Stack Overflow See other posts from Stack Overflow or by futureelite7
Published on 2010-05-13T02:54:22Z Indexed on 2010/05/13 3:04 UTC
Read the original article Hit count: 738

Filed under:
|
|
|
|

Hi,

I have a iPhone application with a few custom-defined colors for my theme. Since these colors will be fixed for my UI, I would like to define the colors in a class to be included (Constants.h and Constants.m). How do I do that? (Simply defining them does not work because UIColors are mutable, and would cause errors - Initalizer not constant).

/* Constants.h */
extern UIColor *test;

/* Constants.m */
UIColor *test = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];

Thanks!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone