zoukankan      html  css  js  c++  java
  • IOS内容属性总结

    四个容易混淆的属性

    1、textAlignment:文字的水平方向对齐方式

    1>取值

    NSTextAlignmentLeft

    NSTextAlignmentCenter

    NSTextAlignmentRight

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

    UITextField

    UILabel

    UITextView

    2.ContentVerticalAlignment:内容的垂直方向的对齐方式

    1>取值

    UIControlContentVerticalAlignmentCenter

    UIControlContentVerticalAlignmentTop

    UIControlContentVerticalAlignmentBottom

    2>哪些控件有这个属性:继承至UIControl的控件或者UIControl本身

    UIControl

    UIButton

    UITextField……

    3.contentHorizontalAlignment:内容的水平方向的对齐方式

    1>取值

    UIControlContentHorizontalAlignmentCenter

    UIControlContentHorizontalAlignmentLeft

    UIControlContentHorizontalAlignmentRight

    2>哪些控件有这个属性:继承至UIControl的控件或者UIControl本身

    UIControl

    UIButton

    UITextField……

    4.contentMode:内容模式(控制内容的对齐方式),一般对UIImageView很有用

    1>取值

    UIViewContentModeScaleToFill:拉伸图片至填充整个UIImageView

    UIViewContentModeScaleAspectFit:按照图片原来的宽高比进行拉伸,伸缩至适应整个UIImageView

    UIViewContentModeScaleAspectFill:按照图片原来的宽高比进行拉伸,伸缩至图片的宽度和UIImageView的宽度一样,或者图片的高度和UIImageView的高度一样

    UIViewContentModeRedraw:当控件的尺寸改变了,就重绘一次(重新调用setNeedDisplay,调用drawRect)

    UIViewContentModeCenter

    UIViewContentModeTop

    UIViewContentModeBottom

    UIViewContentModeLeft

    UIViewContentModeRight

    UIViewContentModeTopLeft

    UIViewContentModeTopRight

    UIViewContentModeBottomLeft

    UIViewContentModeBottomRight

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

  • 相关阅读:
    Linux中使用 FTP 命令时出现 “-bash: ftp: command not found”
    Jenkins Build step 'Execute shell' marked build as failure
    centos7ping www.baidu.com没有ping通
    linux maven 安装
    位运算初步
    C++ STL:next_permutation和prev_permutation
    逆波兰表达式
    STL与基本数据结构
    学习记录:指针(未整理)
    Codeforces Round #615 (Div. 3) 补题记录
  • 原文地址:https://www.cnblogs.com/luseike/p/3925859.html
Copyright © 2011-2022 走看看