UIButton image and text spacing in iOS swift
Problem:
I want to design my button as first image then one space followed by text.How to achieve that in swift?
Solution:
myButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 5)
myButton.titleEdgeInsets = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0)
myButton.setImage(myimage , for: .normal)
myButton.setTitle("title", for: .normal)
myButton.contentHorizontalA
Comments
Post a Comment