zoukankan      html  css  js  c++  java
  • UIButton的titleLabel

    UIButton的titleLabel

    @property(nonatomic, readonly, retain) UILabel *titleLabel
     
    Description - 描述
    A view that displays the value of the currentTitle property for a button. (read-only)

    显示当前的button的文本(只读)
    Although this property is read-only, its own properties are read/write. Use these properties primarily to configure the text of the button.

    虽然这个属性是只读的,但它自己的子属性是可读写的,你可以用他们来设置一些样式:

    For example:
    UIButton *button                  = [UIButton buttonWithType: UIButtonTypeSystem];
    button.titleLabel.font            = [UIFont systemFontOfSize: 12];
    button.titleLabel.lineBreakMode   = UILineBreakModeTailTruncation;


    Do not use the label object to set the text color or the shadow color. Instead, use the setTitleColor:forState: and setTitleShadowColor:forState: methods of this class to make those changes.

    不要直接用label对象来设置文本颜色以及阴影颜色.相对的,你可以使用方法setTitleColor:forState: setTitleShadowColor:forState: 来做这些改变.
    The titleLabel property returns a value even if the button has not been displayed yet. The value of the property is nil for system buttons.

    这个titleLabel属性能够返回值,即使这个button还没有被夹在,对于系统按钮而言,这个值为空.

    你可以使用这个属性来与字符串比较判断哪个按钮别点击了.

  • 相关阅读:
    用上帝视角来看待组件的设计模式
    npm和package.json那些不为常人所知的小秘密
    四步走查智能硬件异常Case
    PorterDuffXfermode 图像混合技术在漫画APP中的应用
    发布流程进化史
    二叉搜索树的操作集
    02-线性结构1 两个有序链表序列的合并
    07-图6 旅游规划
    树的同构
    线性结构4 Pop Sequence
  • 原文地址:https://www.cnblogs.com/YouXianMing/p/3793145.html
Copyright © 2011-2022 走看看