开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜