button选custom

然后在viewDidLoad()中:

 

 

//普通状态下:

UIImage *buttonImageNormal = [UIImage imageNamed:@"whiteButton.png"];
UIImage *stretchableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[self.doSomething setBackgroundImage:stretchableButtonImageNormal forState:UIControlStateNormal];
//按下时高亮:
UIImage *buttonImagePressed = [UIImage imageNamed:@"blueButton.png"];
UIImage *stretchableButtonImagePressed = [buttonImagePressed stretchableImageWithLeftCapWidth:12 topCapHeight:0];
[self.doSomething setBackgroundImage:stretchableButtonImagePressed forState:UIControlStateHighlighted];