开发者

Scale image to fit in UIButton

开发者 https://www.devze.com 2023-01-12 23:52 出处:网络
I have a problem with the UIButtons. How can I scale a i开发者_如何学编程mage to fit their frame?UIButton *Btn = [UIButton buttonWithType:UIButtonTypeCustom];

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

精彩评论

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