What's the difference between setBackgroundImage:Forstate and setImage:Forstate:

前端 未结 3 1934
花落未央
花落未央 2021-01-04 01:18

I am trying to set a image for a UIButton.

I don\'t know the difference between the setBackgroundImage:Forstate and setImage:Forstate:

Could anyone help me o

3条回答
  •  庸人自扰
    2021-01-04 01:56

    setBackgroundImage: follows the frame, i.e. if u change the frame, the background image is streched or shrinked with it. Contrary on the setImage, its not the same. The image takes its own size. In setImage the image is the actual content of the button.

提交回复
热议问题