I am a newbie with Objective C. How would I set the background of this button to an image (image is already in the resources folder in XCode, \"blue_button.png\") instead o
You need to declare your button with the following UIButtonTypeCustom type:
btnClear = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
Then you should be able to use the follow:
[btnClear setImage:[UIImage imageNamed:@"blue_button.png"] forState:UIControlStateNormal];
There are 6 different control states that can be set.
enum {
UIControlStateNormal = 0,
UIControlStateHighlighted = 1 << 0,
UIControlStateDisabled = 1 << 1,
UIControlStateSelected = 1 << 2,
UIControlStateApplication = 0x00FF0000,
UIControlStateReserved = 0xFF000000
};
Here are some references that may help:
UIButton Class Reference
UIControl Class Reference