import Foundation
import UIKit
//
// UILabel.h
// UIKit
//
// Copyright (c) 2006-2016 Apple Inc. All rights reserved.
//
@available(iOS 2.0, *)
public class UILabel : UIView, NSCoding, UIContentSizeCategoryAdjusting {
// lable 显示的 文本信息
public var text: String? // default is nil
// 文本的字体
public var font: UIFont! // default is nil (system font 17 plain)
// 文本的颜色
public var textColor: UIColor! // default is nil (text draws black)
// 文本的阴影
public var shadowColor: UIColor? // default is nil (no shadow)
// 文本的阴影偏移
public var shadowOffset: CGSize // default is CGSizeMake(0, -1) -- a top shadow
// 文本的排列
public var textAlignment: NSTextAlignment // default is NSTextAlignmentNatural (before iOS 9, the default was NSTextAlignmentLeft)
// 文本的换行模式
public var lineBreakMode: NSLineBreakMode // default is NSLineBreakByTruncatingTail. used for single and multiple lines of text
// the underlying attributed string drawn by the label, if set, the label ignores the properties above.
@available(iOS 6.0, *)
// 属性文本 ( TextKit 的主要内容 )
@NSCopying public var attributedText: AttributedString? // default is nil
// the 'highlight' property is used by subclasses for such things as pressed states. it's useful to make it part of the base class as a user property
// 高亮的文本颜色
public var highlightedTextColor: UIColor? // default is nil
// 是否高亮
public var isHighlighted: Bool // default is NO
// 是否响应用户事件(no ,用户事件将从事件队列中移除)
public var isUserInteractionEnabled: Bool // default is NO
public var isEnabled: Bool // default is YES. changes how the label is drawn
// this determines the number of lines to draw and what to do when sizeToFit is called. default value is 1 (single line). A value of 0 means no limit
// if the height of the text reaches the # of lines or the height of the view is less than the # of lines allowed, the text will be
// truncated using the line break mode.
// 文本的行数
public var numberOfLines: Int
// these next 3 property allow the label to be autosized to fit a certain width by scaling the font size(s) by a scaling factor >= the minimum scaling factor
// and to specify how the text baseline moves when it needs to shrink the font.
public var adjustsFontSizeToFitWidth: Bool // default is NO
public var baselineAdjustment: UIBaselineAdjustment // default is UIBaselineAdjustmentAlignBaselines
@available(iOS 6.0, *)
public var minimumScaleFactor: CGFloat // default is 0.0
// Tightens inter-character spacing in attempt to fit lines wider than the available space if the line break mode is one of the truncation modes before starting to truncate.
// The maximum amount of tightening performed is determined by the system based on contexts such as font, line width, etc.
@available(iOS 9.0, *)
public var allowsDefaultTighteningForTruncation: Bool // default is NO
// override points. can adjust rect before calling super.
// label has default content mode of UIViewContentModeRedraw
public func textRect(forBounds bounds: CGRect, limitedToNumberOfLines numberOfLines: Int) -> CGRect
// 在指定的范围内进行文本绘制(或者绘制阴影)
// 这个方法不能被直接调用,只有当子类需要修改默认的文本绘制行为的时候,才在子类中重写,这个方法只能被子类重写,
public func drawText(in rect: CGRect)
// Support for constraint-based layout (auto layout) 支持自动布局
// If nonzero, this is used when determining -intrinsicContentSize for multiline labels
// 如果为非零值,在多行文本下调用 -intrinsicContentSize 方法就会被调用
@available(iOS 6.0, *)
// 优先的多行文本布局最大宽度
// 当使用 约束进行文本布局的时候,这个属性就会影响文本的尺寸,如果文本的扩展超过这个属性指定的值,
// 文本就会另起一行,并增加 文本的高度
public var preferredMaxLayoutWidth: CGFloat
}
UILable.h
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 新爱莲说Hélène, je m'appelle Hélène/Hélène Rollès 蓍草填词/江北客@伏羲...
- objc-runtime.h 中代码: #include <objc/runtime.h> #include<ob...
- 小时候真的很好,爸爸妈妈,还有奶奶都在,他们都在。虽然那个时候,因为为了生活,爸爸妈妈都是在我还没醒来的时候都出门...