Random three dots following UIImage in button
ios, swift, uibutton, uiimage
Solution
Try this out :
let playButton: UIButton = {
let button = UIButton(type: .system)
button.translatesAutoresizingMaskIntoConstraints = false
button.isUserInteractionEnabled = true
let image = UIImage(named: "play")
button.tintColor = UIColor.white
button.setImage(image, for: .normal)
return button
}()
As you setting the title the title text is not fitting into the button Frame and hence you see the three dotted lines.
Problem
I am trying to overlay a play image on a chat cell (UICollectionView Cell) This is the button I am using: However, I notice this effect with every image I use. Below is the code for the button I am constructing. ``` let playButton: UIButton = { let button = UIButton(type: .system) button.setTitle("Play Video", for: .normal) button.translatesAutoresizingMaskIntoConstraints = false button.isUserInteractionEnabled = true let image = UIImage(named: "play") button.tintColor = UIColor.white button.setImage(image, for: .normal) return button }() ``` This is what it looks like in the simulator: Why might my UIImage append these dots?