- (void)viewDidLoad
{
[super viewDidLoad];
UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(50, 50, 60, 60);
[btn setBackgroundImage:[UIImage imageNamed:@"a"] forState:UIControlStateNormal];
[btn setBackgroundImage:[UIImage imageNamed:@"b"] forState:UIControlStateHighlighted];
[btn addTarget:self action:@selector(btnPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
- (void)btnPressed:(UIButton *)btn
{
[btn setBackgroundImage:[UIImage imageNamed:@"a"] forState:UIControlStateNormal];
[btn setBackgroundImage:[UIImage imageNamed:@"b"] forState:UIControlStateHighlighted];
}