05 Apr 2009, 15:48
Ypt665_pragsmall

Cristian Smochina (34 posts)

Hi there,

Is there a way to change an UIButton’s background color? If I use the inherited property backgroundColor it just changes the button’s corners color…
I’ve looked around and found that you can use an image, or images for the different states of the button, but I don’t have photoshop and even if I did, my graphic skills are very limited.

I hope there is a better way to do this, from code, for example, the built in behavior is when you press a button it turns blue, I don’t think it has an image just for that. Also, the Stocks application has the button green or red with darker green/red outlines.

If not, I’m downloading Gimp right now, can’t be that hard to draw a button…

Ok, here’s the weird part…
I made these two buttons

http://img49.imageshack.us/img49/4142/greenk.png
http://img523.imageshack.us/img523/3758/red.png

On emulator, they work just fine and display as they are. On the phone though, only the green one is showed, and instead of the red one, the button is white with a gray outline… Ok, if there were a problem with the red png file, where did it come up with a white color, no gradient, and gray outline???

http://img17.imageshack.us/my.php?image=2383467…

Has anyone encountered this before?

05 Apr 2009, 20:59
Ypt665_pragsmall

Cristian Smochina (34 posts)

Ok, found what the problem was.
I named the files green.png and Red.png, but was trying to load red.png. Seems like the iphone os is case sensitive…

  You must be logged in to comment