iOS开发button常用设置
//设置按钮文本居左
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
//设置按钮文本居右
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//设置文字偏移量(上左下右) 有间距更好看
button.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
tips:
无用设置
button.titleLabel.textAlignment = NSTextAlignmentLeft;这样设置是无用的
网友评论