0

Swift is not downscaling my image to fit to AspectFit and is at pre-downscaled size. Links to pictures are provided.

@objc private func didDoubleTap(_ gesture: UITapGestureRecognizer) {
        let likedImage = UIImage(named: "likedImage")
        likeButton.setImage(likedImage, for: .normal)
        likeButton.contentMode = .center //344 436 50 50
        likeButton.imageView?.contentMode = .scaleAspectFit
    }

before double tapping

enter image description here

after double tapping

enter image description here

Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165
Dave B
  • 1

1 Answers1

0

You have to set the size of with and height then

just add the imageEdgeInsets

button.imageEdgeInsets = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
Manikandan S
  • 115
  • 3
  • 18