如何让按钮UIButton的文字左对齐?
2016-04-05 16:15
525 查看
1.推荐两种方案:
UIEdgeInsets titleEdgeInsets; 属性就行了,使用UIEdgeInsetsMake(CGFloat
top, CGFloat left, CGFloat bottom, CGFloat right)构造一个结构体,设置给btn即可。
左对齐UIEdgeInsetsMake(0, -20,0 , 0);(数值自己看着调把)
btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
UIEdgeInsets titleEdgeInsets; 属性就行了,使用UIEdgeInsetsMake(CGFloat
top, CGFloat left, CGFloat bottom, CGFloat right)构造一个结构体,设置给btn即可。
左对齐UIEdgeInsetsMake(0, -20,0 , 0);(数值自己看着调把)
btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
相关文章推荐
- iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片上下垂直居中对齐
- Swift之贪婪的UIButton
- UIButton拖动响应事件,距离问题
- IOS 7.1 兼容性bug 问题,UIButton,UILabel ...
- UIKit框架(18)UIButton和UITextField
- UIButton小结
- iOS控件--UIButton
- [Swift]UIKit学习之UIButton的用法
- UIButton的使用
- 第一个IOS程序(代码版)
- IOS 简易图片浏览器
- iOS UI三大控件和应用程序启动流程
- iOS UIButton的简单实用方法
- iOS 短信验证码
- UIButton
- 九宫格的算法
- 计算文本和图片的高度
- IOS 设置 navigationItem.rightBarButtonItem leftBarButtonItem 字体按钮
- 发散按钮浅谈
- iOS中UIButton的block