How to not stretch an image in UIButton

前端 未结 7 801
深忆病人
深忆病人 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:58

    Storyboard

    Property image.

    You must define specific property in Runtime Attributes of Identity inspectorimageView.contentMode, where you set value relatively to rawValue position of enum UIViewContentMode. 1 means scaleAspectFit.

    And button's alignment, in Attributes inspector:

提交回复
热议问题