How do I scale a UIButton's imageView?

前端 未结 19 2976
刺人心
刺人心 2020-12-02 05:16

I created a UIButton instance named \"button\" with an image using [UIButton setImage:forState:]. The button.frame is larger than the image\'s size.

Now

19条回答
  •  情书的邮戳
    2020-12-02 05:58

    I just ran into this same problem, and there's a possible answer in this question:

    Why does a custom UIButton image does not resize in Interface Builder?

    Essentially, use the backgroundimage property instead, which does get scaled.

提交回复
热议问题