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)];
本文详细介绍了如何使用UIEdgeInsets属性调整UIButton上的图片和文字位置,包括使用UIEdgeInsetsMake创建边缘间距的方法,以及如何调整图片和文字的具体位置。
3023

被折叠的 条评论
为什么被折叠?



