UITextField(FWUIKit)

@interface UITextField (FWUIKit)

/// 最大字数限制,0为无限制,二选一
@property (nonatomic, assign) NSInteger fw_maxLength NS_REFINED_FOR_SWIFT;

/// 最大Unicode字数限制(中文为1,英文为0.5),0为无限制,二选一
@property (nonatomic, assign) NSInteger fw_maxUnicodeLength NS_REFINED_FOR_SWIFT;

/// 自定义文字改变处理句柄,默认nil
@property (nonatomic, copy, nullable) void (^fw_textChangedBlock)(NSString *text) NS_REFINED_FOR_SWIFT;

/// 文本长度发生改变,自动检测字数限制,用于代码设置text等场景
- (void)fw_textLengthChanged NS_REFINED_FOR_SWIFT;

/// 获取满足最大字数限制的过滤后的文本,无需再调用textLengthChanged
- (NSString *)fw_filterText:(NSString *)text NS_REFINED_FOR_SWIFT;

/// 设置自动完成时间间隔,默认0.5秒,和autoCompleteBlock配套使用
@property (nonatomic, assign) NSTimeInterval fw_autoCompleteInterval NS_REFINED_FOR_SWIFT;

/// 设置自动完成处理句柄,默认nil,注意输入框内容为空时会立即触发
@property (nullable, nonatomic, copy) void (^fw_autoCompleteBlock)(NSString *text) NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 最大字数限制,0为无限制,二选一

    Declaration

    Objective-C

    @property (nonatomic) NSInteger fw_maxLength;
  • 最大Unicode字数限制(中文为1,英文为0.5),0为无限制,二选一

    Declaration

    Objective-C

    @property (nonatomic) NSInteger fw_maxUnicodeLength;
  • 自定义文字改变处理句柄,默认nil

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (NSString *_Nonnull __strong) fw_textChangedBlock;
  • 文本长度发生改变,自动检测字数限制,用于代码设置text等场景

    Declaration

    Objective-C

    - (void)fw_textLengthChanged;
  • 获取满足最大字数限制的过滤后的文本,无需再调用textLengthChanged

    Declaration

    Objective-C

    - (nonnull NSString *)fw_filterText:(nonnull NSString *)text;
  • 设置自动完成时间间隔,默认0.5秒,和autoCompleteBlock配套使用

    Declaration

    Objective-C

    @property (nonatomic) NSTimeInterval fw_autoCompleteInterval;
  • 设置自动完成处理句柄,默认nil,注意输入框内容为空时会立即触发

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) void (^) (NSString *_Nonnull __strong) fw_autoCompleteBlock;