How to adjust an UIButton's imageSize?

前端 未结 16 2368
时光说笑
时光说笑 2021-01-29 21:40

How can I adjust the image size of the UIButton? I am setting the image like this:

[myLikesButton setImage:[UIImage imageNamed:@\"icon-heart.png\"] forState:UICo         


        
16条回答
  •  情书的邮戳
    2021-01-29 22:18

    i think, your image size is also same as button size then you put image in background of the button like :

    [myLikesButton setBackgroundImage:[UIImage imageNamed:@"icon-heart.png"] forState:UIControlStateNormal];
    

    you mast have same size of image and button.i hope you understand my point.

提交回复
热议问题