Scale image to fit in UIButton
I have a problem with the UIButtons. How can I scale a i开发者_如何学编程mage to fit their frame?
UIButton *Btn = [UIButton buttonWithType:UIButtonTypeCustom];
Btn.frame = //set frame using CGRectMake(x,y,width,height);
[Btn setBackgroundImage:[UIImage imageNamed:@"image name here"] forState:UIControlStateNormal];
Just needed to combine setbackgroundimage and set to fill
精彩评论