Dzior Dzior - 1 year ago 69
iOS Question

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

with image and title.

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?

Answer Source

Thanks to the link provided I have used

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