How to not stretch an image in UIButton

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

    Swift 4.X and 5.X

    button.imageView!.contentMode = .scaleAspectFit
    button.contentVerticalAlignment = .fill
    button.contentHorizontalAlignment = .fill
    
    0 讨论(0)
提交回复
热议问题