Sorry if this is a a bad question but . . .
I want to create a shortcut to my UIColor that looks like this
[UIColor colorWithRed:(88.0f/255.0f) green:(201.0f/255.0f) blue:(234.0f/255.0f) alpha:1]
Can I use a #define for that somehow so that I can just type in some shortcut? I’ve tried but I think my notation may be off . . .
If a #define is only for constants or for some reason doesn’t apply in this situation, are there any other ways to shortcut that method?
Thanks!
#define is just a glorified text replacement system. If you define something like this:
then the preprocessor will replace every occurrence of
keywithvalueeven before the compiler can do anything. So it doesn’t really matter what you define. You can use anything as your value, so you could do something likeBut in this case you probably should use a static constant variable: