Dzior Dzior - 2 months ago 6x
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?


Thanks to the link provided I have used

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