zoukankan      html  css  js  c++  java
  • [iOS微博项目

    四个容易混淆的属性:
    1. textAligment : 文字的水平方向的对齐方式
    1> 取值
    NSTextAlignmentLeft      = 0,    // 左对齐
    NSTextAlignmentCenter    = 1,    // 居中对齐
    NSTextAlignmentRight    = 2,    // 右对齐

    2> 哪些控件有这个属性 : 一般能够显示文字的控件都有这个属性
    * UITextField
    * UILabel
    * UITextView

    2. contentVerticalAlignment : 内容的垂直方向的对齐方式
    1> 取值
    UIControlContentVerticalAlignmentCenter  = 0, // 居中对齐
    UIControlContentVerticalAlignmentTop     = 1, // 顶部对齐
    UIControlContentVerticalAlignmentBottom  = 2, // 底部对齐

    2> 哪些控件有这个属性 : 继承自UIControl的控件或者UIControl本身
    * UIControl
    * UIButton
    * UITextField
    * ...

    3. contentHorizontalAlignment : 内容的水平方向的对齐方式
    1> 取值
    UIControlContentHorizontalAlignmentCenter = 0, // 居中对齐
    UIControlContentHorizontalAlignmentLeft   = 1, // 左对齐
    UIControlContentHorizontalAlignmentRight  = 2, // 右对齐

    2> 哪些控件有这个属性 : 继承自UIControl的控件或者UIControl本身
    * UIControl
    * UIButton
    * UITextField
    * ...

    4. contentMode : 内容模式(控制内容的对齐方式), 一般对UIImageView很有用
    1> 取值
    /**
    规律:
    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,

    2> 哪些控件有这个属性 : 所有UI控件都有

    5. 如果有多个属性的作用冲突了, 只有1个属性有效(就近原则)
     
     
  • 相关阅读:
    托付和事件的使用
    在使用supervisord 管理tomcat时遇到的小问题
    无法安装vmware tools的解决方PLEASE WAIT! VMware Tools is currently being installed on your system. Dependin
    (转)Openlayers 2.X加载高德地图
    (转)openlayers实现在线编辑
    (转) Arcgis for js加载百度地图
    (转)Arcgis for js加载天地图
    (转) 基于Arcgis for Js的web GIS数据在线采集简介
    (转) Arcgis for js之WKT和GEOMETRY的相互转换
    (转)Arcgis for Js之Graphiclayer扩展详解
  • 原文地址:https://www.cnblogs.com/hellovoidworld/p/4270168.html
Copyright © 2011-2022 走看看