UIButton won't go to Aspect Fit in iPhone

后端 未结 21 2166
小鲜肉
小鲜肉 2020-12-23 02:47

I have a couple UIButtons, and in IB they\'re set to Aspect Fit, but for some reason they\'re always stretching. Is there something else you have to set? I tried all the d

21条回答
  •  离开以前
    2020-12-23 03:06

    If you are doing this in Interface Builder, you can use the Runtime attributes inspector to set this directly without any code.

    Set your Key Path on the button to be "imageView.contentMode" with a type of "Number" and a value of "1" (or whichever mode you would like).

提交回复
热议问题