【发布时间】:2018-03-13 18:42:16
【问题描述】:
button.setTitle("Like", for: .normal)
button.setTitleColor(UIColor.rgb(red: 143, green: 150, blue: 163), for: .normal)
button.setImage(UIImage(named:"like"), for: .normal)
button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 8 , bottom:0, right: 0)
button.imageView?.contentMode = .scaleAspectFit
addConstraintsWithFormat(format: "H:|[v0]|", views: likeButton)
addConstraintsWithFormat(format: "V:|[v0(44)]|", views:likeButton)
如果我删除“button.setImage(UIImage(named:"like"), for: .normal)”行,那么标题会正确显示。如何同时显示标题和图像?
【问题讨论】:
-
您的边缘插图最有可能导致标题消失。边缘插图 40 非常极端!
-
还是不行
-
实际图像有多大?
-
是375*360像素
-
那是相当大的。按钮会在屏幕上接近那个尺寸吗?尝试将图像设置为您想要的确切尺寸。
标签: ios swift swift3 uibutton uiimage