UIControlEvents枚举:
所有事件
UIControlContentVerticalAlignment枚举:
UIControlContentVerticalAlignmentCenter = 0, 垂直方向居中
UIControlContentVerticalAlignmentTop = 1, 垂直方向居上
UIControlContentVerticalAlignmentBottom = 2, 垂直方向居下
UIControlContentVerticalAlignmentFill = 3, 垂直方向填充
UIControlContentHorizontalAlignment枚举:
UIControlContentHorizontalAlignmentCenter = 0, 水平方向居中
UIControlContentHorizontalAlignmentLeft = 1, 水平方向居左
UIControlContentHorizontalAlignmentRight = 2, 水平方向居右
UIControlContentHorizontalAlignmentFill = 3, 水平方向填充
UIControlState枚举:
UIControlStateNormal = 0, 正常状态
UIControlStateHighlighted = 1 << 0, 高亮状态
UIControlStateDisabled = 1 << 1, 不可用状态
UIControlStateSelected = 1 << 2, 选中状态
UIControlStateFocused NS_ENUM_AVAILABLE_IOS(9_0) = 1 << 3, // Applicable only when the screen supports focus
UIControlStateApplication = 0x00FF0000, // additional flags available for application use
UIControlStateReserved = 0xFF000000 // flags reserved for internal framework use
@property(nonatomic,getter=isEnabled) BOOL enabled; 是否可用
@property(nonatomic,getter=isSelected) BOOL selected; 是否被选中
@property(nonatomic,getter=isHighlighted) BOOL highlighted; 是否高亮
@property(nonatomic) UIControlContentVerticalAlignment contentVerticalAlignment; 垂直方向内容排列方式
@property(nonatomic) UIControlContentHorizontalAlignment contentHorizontalAlignment; 水平方向内容排列方式
@property(nonatomic,readonly) UIControlState state;
@property(nonatomic,readonly,getter=isTracking) BOOL tracking;
@property(nonatomic,readonly,getter=isTouchInside) BOOL touchInside;
- (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)event; 开始追踪触摸事件
- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(nullable UIEvent *)event; 继续追踪触摸事件
- (void)endTrackingWithTouch:(nullable UITouch *)touch withEvent:(nullable UIEvent *)event; 结束追踪触摸事件
- (void)cancelTrackingWithEvent:(nullable UIEvent *)event; 取消追踪触摸事件
- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
添加事件处理方法
- (void)removeTarget:(nullable id)target action:(nullable SEL)action forControlEvents:(UIControlEvents)controlEvents;
移除事件处理方法