I want to set an image to the button
But every time when I add an image to the button it shows a huge image and the image doesn’t fit the button size. Like this:
2
yourButton.clipsToBounds = true yourButton.contentMode = .scaleAspectFill // Use setBackgroundImage or setImage yourButton.setBackgroundImage(UIImage(named: "yourImage"), for: .normal)
Change button style from ‘Plain’ to ‘Default’
Click here for the image reference
Click here to cancel reply.
2
Answers
Change button style from ‘Plain’ to ‘Default’
Click here for the image reference