.h
@interface Control_FunViewController : UIViewController <UIActionSheetDelegate> {
....
UIButton *doSomethingButton;
}
@property (nonatomic, retain) IBOutlet UIButton *doSomethingButton;
@end
.m
@synthesize doSomethingButton;
- (void)viewDidLoad
{
UIImage *buttonImageNormal = [UIImage imageNamed:@"whiteButton.png"];
UIImage *stretchableButtonImageNormal = [buttonImageNormal
stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[doSomethingButton setBackgroundImage:stretchableButtonImageNormal
forState:UIControlStateNormal];
UIImage *buttonImagePressed = [UIImage imageNamed:@"blueButton.png"];
UIImage *stretchableButtonImagePressed = [buttonImagePressed
stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[doSomethingButton setBackgroundImage:stretchableButtonImagePressed
forState:UIControlStateHighlighted];
}