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のエッジ挿入図はかなり極端です! – jervine10
まだ仕事がありません – ismail1983
実際の画像の大きさはどれくらいですか? – jervine10