容易混淆的内容摆放属性:

1. textAligment : 文字的水平方向的对齐方式
  • 取值

    • NSTextAlignmentLeft = 0, // 左对齐
    • NSTextAlignmentCenter = 1, // 居中对齐
    • NSTextAlignmentRight = 2, // 右对齐
  • 哪些控件有这个属性 :一般能够显示文字的控件都有这个属性

    • UITextField
    • UILabel
    • UITextView
2. contentVerticalAlignment : 内容的垂直方向的对齐方式
  • 取值

    • UIControlContentVerticalAlignmentCenter = 0, // 居中对齐
    • UIControlContentVerticalAlignmentTop = 1, // 顶部对齐
    • UIControlContentVerticalAlignmentBottom = 2, // 底部对齐
  • 哪些控件有这个属性 : 继承自UIControl的控件或者UIControl本身

    • UIControl
    • UIButton
    • UITextField
3. contentHorizontalAlignment : 内容的水平方向的对齐方式
  • 取值

    • UIControlContentHorizontalAlignmentCenter = 0, // 居中对齐
    • UIControlContentHorizontalAlignmentLeft = 1, // 左对齐
    • UIControlContentHorizontalAlignmentRight = 2, // 右对齐
  • 哪些控件有这个属性 : 继承自UIControl的控件或者UIControl本身

    • UIControl
    • UIButton
    • UITextField
4. contentMode : 内容模式(控制内容的对齐方式), 一般对UIImageView很有用
  • 取值
/**
规律:
1.Scale : 图片会拉伸
2.Aspect : 图片会保持原来的宽高比
*/
// 前3个情况, 图片都会拉伸
// (默认)拉伸图片至填充整个UIImageView(图片的显示尺寸会跟UIImageView的尺寸一样)
UIViewContentModeScaleToFill,
// 按照图片原来的宽高比进行伸缩, 伸缩至适应整个UIImageView(图片的内容不能超出UIImageView的尺寸范围)
UIViewContentModeScaleAspectFit,
// 按照图片原来的宽高比进行伸缩, 伸缩至 图片的宽度和UIImageView的宽度一样 或者 图片的高度和UIImageView的高度一样
UIViewContentModeScaleAspectFill, // 后面的所有情况, 都会按照图片的原来尺寸显示, 不会进行拉伸
UIViewContentModeRedraw, // 当控件的尺寸改变了, 就会重绘一次(重新调用setNeedsDisplay, 调用drawRect:)
UIViewContentModeCenter,
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
  • 哪些控件有这个属性 : 所有UI控件都有
5. 如果有多个属性的作用冲突了, 只有1个属性有效(就近原则)

最新文章

  1. C#学习系列-类与结构的区别
  2. 2016/12/14---- C3P0
  3. boost 编译
  4. 遍历form表单
  5. Open judge 06月度开销
  6. C# 获取网页数据、获取本机IP 分类: C# 2014-12-16 14:59 308人阅读 评论(0) 收藏
  7. linux dd命令参数及用法详解---用指定大小的块拷贝一个文件(也可整盘备份)
  8. Largest Submatrix(动态规划)
  9. jQeury学习笔记
  10. React native android 最常见的10个问题
  11. java 文件字节输出流
  12. aProxy: 带认证授权和权限控制的反向代理
  13. sql优化原则与技巧
  14. Flask开发基础
  15. python干掉pycache
  16. Mysql分页优化
  17. 解决 git push Failed to connect to 127.0.0.1 port 8-87: 拒绝连接
  18. springcloud-3:required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found.
  19. ajax-简单参数方法实现阴影效果
  20. 解决jmeter乱码

热门文章

  1. 强连通分量+poj2186
  2. C++ 函数部分(1)
  3. python iterable 和list、dictionary的区别和联系
  4. socket.io中文文档
  5. UVA11183 Teen Girl Squad —— 最小树形图
  6. 使用Kotlin如何startActivity
  7. HubbleDotNet开源全文搜索数据库项目--技术详解
  8. codeforces 689C C. Mike and Chocolate Thieves(二分)
  9. AutoIT: 学习对GUI Sample上所有的资源进行操作
  10. python requests 调用restful api