set uibutton title right align programmatically swift 5 code example
Example 1: how to text align button title xcode
emailBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
// Swift 3 and up:
emailBtn.contentEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0);
Example 2: how to text align button title xcode
emailBtn.contentHorizontalAlignment = .left;