Search code examples
iosuibuttoncgcontextuicolor

iOS - Change button color after button press does not work


I used the code found here to color my buttons. I've created some methods similar to those in the code for default coloring such as orangeColor, greenColor and so on.

When My view loads I set the color of my UIButtons, and when one is pressed I want to change the color of the buttons to reflect their change in function, I do the following (considering the buttons are a different color):

[self.recordPlayButton greenColor];
[self.recordPlayButton setNeedsDisplay];
[self.stopRecordButton orangeColor];
[self.stopRecordButton setNeedsDisplay];

But the color of my buttons remains the same, any idea why this happens?

EDIT: another odd thing I just noticed is that the highlight color for the button changes but not the normal color.


Solution

  • http://code.google.com/p/iphonegradientbuttons/issues/detail?id=4

    If you look at the Wiki for the gradient buttons, you can see that it's actually defect in iOS5. Have you tested if the demo works on your device?