How to not stretch an image in UIButton

前端 未结 7 802
深忆病人
深忆病人 2020-12-23 11:35

I\'m trying to create a custom UITableViewCell programmatically and one of the subviews of this cell is going to be a button with an image in it (a simple image of a magnify

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 11:42

    Make sure the button is a Custom UIButton

    Just using setImage: did not work for me on iOS9.

    But it worked combined with myButton.imageView.contentMode = UIViewContentMode.ScaleAspectFit;

提交回复
热议问题