Code implementation:
[Btnright settitleedgeinsets:uiedgeinsetsmake (0,-imgarrow.size.width, 0, ImgArrow.size.width)];
[Btnright setimageedgeinsets:uiedgeinsetsmake (0, BtnRight.titleLabel.bounds.size.width, 0,- BtnRight.titleLabel.bounds.size.width)];
UIButton default is left picture, right text. And the position has been set before the edge insets is set. So setting the title of The Edge insets, the real function is to increase or decrease a certain distance on the basis of the original margin value, the negative value is reduced. Take the title as an example, set the right margin to increase the width of the picture, so that the right edge of their own border distance button to the right of the width of the picture, just put the film. At this point, the title lable has become smaller, and the title lable the left edge of the original position, so the left edge of the lable to reduce the width of the left border of the picture, lable is as big as the original, and the left start position and the picture left the same position.
Xib implementation:
UIButton implement left text right picture