Reputation: 217
using this code:
button.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
button.transform = CGAffineTransformMakeScale(-1.0, 1.0);
button.titleLabel.transform = CGAffineTransformMakeScale(-1.0, 1.0);
button.imageView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
What I'm trying to achieve is this:
Where the image and UILabel should be on the left side of the UIButton, not in the middle.
Upvotes: 1
Views: 251
Reputation: 91
To done this in Interface Builder you just need to change "alignment" property....
1.In attribute inspector of button change alignment Property to first option
2. this will be your output
3.if you want some space between image and title you can give from size inspector (just give some space in left property of title insets)
4.Final Output
Upvotes: 0
Reputation: 392
Try contentHorizontalAlignment
property.
Objective-C
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
Swift
button.contentHorizontalAlignment = .left
Upvotes: 2