UIControl中的相关属性和方法

UIControlEvents枚举:
    UIControlEventTouchDown                单点触摸按下事件    
    UIControlEventTouchDownRepeat    多点触摸按下事件,点触计数大于1    
    UIControlEventTouchDragInside       当一次触摸在控件窗口内拖动时    
    UIControlEventTouchDragOutside    当一次触摸在控件窗口之外拖动时    
    UIControlEventTouchDragEnter        当一次触摸从控件窗口之外拖动到内部时    
    UIControlEventTouchDragExit           当一次触摸从控件窗口内部拖动到外部时    
    UIControlEventTouchUpInside          在控件内部触摸抬起事件    
    UIControlEventTouchUpOutside       在控件外部触摸抬起事件(点触必须开始于控件内部才会发送通知)    
    UIControlEventTouchCancel             触摸取消事件,即一次触摸因为放上了太多手指而被取消,或者被上锁或者电话呼叫打断    
    UIControlEventTouchChanged         当控件的值发生改变时,发送通知。用于滑块、分段控件、以及其他取值的控件。你可以配置滑块控件何时发送通知,在滑块被放下时发送,或者在被拖动时发送    
    UIControlEventEditingDidBegin       当文本控件开始编辑时发送通知    
    UIControlEventEditingChanged       当文本控件中的文本被改变时发送通知    
    UIControlEventEditingDidEnd          当文本控件编辑结束时发送通知    
    UIControlEventEditingDidOnExit      当文本控件结束编辑时,发送通知    
    UIControlEventAlltouchEvents         所有触摸事件    
    UIControlEventAllEditingEvents       所有关于文本编辑的事件   
    UIControlEventAllEvents                  所有事件
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:(nullableUIEvent *)event;        开始追踪触摸事件
- (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(nullableUIEvent *)event;     继续追踪触摸事件
- (void)endTrackingWithTouch:(nullableUITouch *)touch withEvent:(nullableUIEvent *)event;  结束追踪触摸事件
- (void)cancelTrackingWithEvent:(nullableUIEvent *)event;                                  取消追踪触摸事件
- (void)addTarget:(nullableid)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents;
     添加事件处理方法
- (void)removeTarget:(nullableid)target action:(nullableSEL)action forControlEvents:(UIControlEvents)controlEvents;
     移除事件处理方法

你可能感兴趣的:(UIControl中的相关属性和方法)