Reputation: 493
I've built a set of custom colours to use in my app, such as lime
mylimeColor = [UIColor colorWithRed:0.502 green:1.000 blue:0.000 alpha:1.000];
Setting something to this colour works fine, but I'm struggling later in my app when I want to change something depending on which of my custom colours a view has. I was using the following with no issue:
if (bgColor == [UIColor redColor]) {
// do something
}
but this breaks as soon as I start to use my own colours.
if (bgColor == myredColor) {
// do something
}
I can check the background colour in NSLog and it looks exactly as I would expect.
Is there another way for me to find out what the background of something (UIView, UITextFeild, etc) is? I have looked online but only seem to be finding help setting my custom colours, which hasn't been an issue for me.
My next step is going to be to set an integer to a specific number with each colour and check that instead, but it seems that comparing the colour itself would be a better way of doing this.
Thanks for your help!!
Upvotes: 1
Views: 244