Dzior
Dzior

Reputation: 1495

UIButton image on right title in center

I was searching through the post and trying to figure it out by myself but it is hardly working.

I want to use an UIButton with image and title.
UIButton spans across (almost) whole screen.
The image should be positioned on the right edge of the button.
The title should be centered in the whole button.

How can I do it with insets?

Upvotes: 1

Views: 3410

Answers (1)

Dzior
Dzior

Reputation: 1495

Thanks to the link provided I have used

Control.ContentEdgeInsets = new UIEdgeInsets(0, -imageWidth, 0, 0);
Control.ImageEdgeInsets = new UIEdgeInsets(0, controlWidth, 0, 0);

Upvotes: 11

Related Questions