【发布时间】:2017-05-08 04:54:52
【问题描述】:
我正在尝试在聊天单元格 (UICollectionView Cell) 上叠加播放图像
但是,我注意到我使用的每张图片都有这种效果。下面是我正在构建的按钮的代码。
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
}()
这是它在模拟器中的样子:
为什么我的 UIImage 会附加这些点?
【问题讨论】:
-
移除 UIButton 的 setTitle,因为您不需要为 Play Image 显示文本。
-
它是按钮的标题,从
playButton@Ricky Avina 中删除这行代码button.setTitle("Play Video", for: .normal)
标签: ios swift uibutton uiimage