UIButton(loading...)

1. 按钮的文字 垂直 对齐方式

button.contentVerticalAlignment = UIControlContentVerticalAlignmentBottom; // 按钮都是有状态的, 不同状态下对应不同的标题


2. 按钮内容居左显示

_nameButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

        

3. 设置按钮内边距

_nameButton.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);

        

4. 按钮leble内边距

_nameButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);

        

5. 居中显示

_nameButton.contentMode = UIViewContentModeCenter;

        

6. 不允许剪切超出部分

_nameButton.clipsToBounds = NO;


7. 给按钮 设置图片和标题(title) 不能用点语法(因为有状态不一样, 图片和标题也不一样)


猜你喜欢

转载自blog.csdn.net/Michael_234198652/article/details/50810042