UIControl(FWBlock)

@interface UIControl (FWBlock)

/// 添加事件句柄
- (NSString *)fw_addBlock:(void (^)(id sender))block forControlEvents:(UIControlEvents)controlEvents NS_REFINED_FOR_SWIFT;

/// 根据唯一标志移除事件句柄
- (void)fw_removeBlock:(nullable NSString *)identifier forControlEvents:(UIControlEvents)controlEvents NS_REFINED_FOR_SWIFT;

/// 移除所有事件句柄
- (void)fw_removeAllBlocksForControlEvents:(UIControlEvents)controlEvents NS_REFINED_FOR_SWIFT;

/// 添加点击事件
- (void)fw_addTouchTarget:(id)target action:(SEL)action NS_REFINED_FOR_SWIFT;

/// 添加点击句柄
- (NSString *)fw_addTouchBlock:(void (^)(id sender))block NS_REFINED_FOR_SWIFT;

/// 根据唯一标志移除点击句柄
- (void)fw_removeTouchBlock:(nullable NSString *)identifier NS_REFINED_FOR_SWIFT;

/// 移除所有点击句柄
- (void)fw_removeAllTouchBlocks NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 添加事件句柄

    Declaration

    Objective-C

    - (nonnull NSString *)fw_addBlock:(nonnull void (^)(id _Nonnull __strong))block
                     forControlEvents:(UIControlEvents)controlEvents;
  • 根据唯一标志移除事件句柄

    Declaration

    Objective-C

    - (void)fw_removeBlock:(nullable NSString *)identifier
          forControlEvents:(UIControlEvents)controlEvents;
  • 移除所有事件句柄

    Declaration

    Objective-C

    - (void)fw_removeAllBlocksForControlEvents:(UIControlEvents)controlEvents;
  • 添加点击事件

    Declaration

    Objective-C

    - (void)fw_addTouchTarget:(nonnull id)target action:(nonnull SEL)action;
  • 添加点击句柄

    Declaration

    Objective-C

    - (nonnull NSString *)fw_addTouchBlock:
        (nonnull void (^)(id _Nonnull __strong))block;
  • 根据唯一标志移除点击句柄

    Declaration

    Objective-C

    - (void)fw_removeTouchBlock:(nullable NSString *)identifier;
  • 移除所有点击句柄

    Declaration

    Objective-C

    - (void)fw_removeAllTouchBlocks;