UIButton的imageEdgeInsets和titleEdgeInsets
2016-02-26 17:26
218 查看
1、UIButton上有两个控件,UIImageView和UILabel,用来显示图片(不是背景图片)和文字。
为了方便,我用image.width,代表image的宽度label.width代表label的宽度默认情况下,image在label的左边,他俩居中显示在button的中间,这个可以通过button的contentHorizontalAlignment属性来改变他俩的居中方式
当button.width >= image.witdh + label.width时,上面的默认情况成立
当(button.width < image.width + label.width)&&(button.width >=image.width)时,image正常显示,label会部分显示或不显示
当(button.width < image.width)&&(button.width < image.width)时,图片会被压缩显示
2、imageEdgeInsets和titleEdgeInsets的使用
Insets的使用是按着逆时针用的,即是个参数分别代表上、左、下、右,与网页上的布局相反,网页上的布局是顺时针。注意向左、向上移动image或者label,参数是负数,向右、向下移动,参数是正数
相关文章推荐
- toString() ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE)
- 蓝图(blueprint)的理解和用法
- 远程编译 BlueZ ARM交叉编译环境配置(-)----PASS
- 浅谈AbstractQueuedSynchronizer原理
- UITableView 的全部代理方法
- 使用XIB自定义一个UIView,然后将…
- UICollectionView 使用
- 详解 CALayer 和 UIView 的区别和联系
- 利用Android常用UI控件完成简单地注册功能
- 1062. Talent and Virtue (25)
- B-Queue on Bus Stop
- 修改Android Studio Build生成apk的默认名称
- 详释(常见UITextView 输入之字数限制)之一---固定长度
- iOS--Core Bluetooth
- LAoj 2678 - Subsequence (DP&技巧&排序)
- Guess the Permutation
- easyui datagrid 部分参数整理
- C# 项目迁移 Microsoft.VisualStudio.Tools.Office.BuildTasks 生成解决方法报错:请确认 <UsingTask> 声明正确,该程序集及其所有依赖项都可用
- Win8.1+Ubuntu双系统(UEFI+GPT)
- 取消UISearchbar背景色