UIButton上的图片和文字位置调整:
属性: imageEdgeInsets
contentEdgeInsets
UIEdgeInsetsMake
Creates an edge inset for a button or view.
UIEdgeInsets UIEdgeInsetsMake (
CGFloat top,
CGFloat left,
CGFloat bottom,
CGFloat right
);
Parameters
top
The inset at the top of an object. 距离顶部的间隔
left
The inset on the left of an object 距离左边的间隔
bottom
The inset on the bottom of an object. 距离底部的间隔
right
The inset on the right of an object. 距离右边的间隔
注:
图片设置左边距改变横向位置,文字设置右边距改变横向位置
[Btn setImageEdgeInsets:UIEdgeInsetsMake(0, 90, 0, 0)];
[Btn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 40)];