UIImage *yourImage = [UIImage imageNamed:@"whatever.png"];
CGSize yourButtonSize = yourButton.frame.size;
UIGraphicsBeginImageContext(yourButtonSize);
CGContextRef context = UIGraphicsGetCurrentContext();
// Draw the image vertically centered in the button's frame.
[yourImage drawInRect:CGRectMake(0.0, floor((yourButton.height - yourImage.height) / 2.0), yourImage.width, yourImage.height)];
// New button background image.
UIImage *yourPaddedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();