UISearchBar(FWUIKit)

@interface UISearchBar (FWUIKit)

/// 自定义内容边距,可调整左右距离和TextField高度,未设置时为系统默认
@property (nonatomic, assign) UIEdgeInsets fw_contentInset NS_REFINED_FOR_SWIFT;

/// 自定义取消按钮边距,未设置时为系统默认
@property (nonatomic, assign) UIEdgeInsets fw_cancelButtonInset NS_REFINED_FOR_SWIFT;

/// 输入框内部视图
@property (nullable, nonatomic, weak, readonly) UITextField *fw_textField NS_REFINED_FOR_SWIFT;

/// 取消按钮内部视图,showsCancelButton开启后才存在
@property (nullable, nonatomic, weak, readonly) UIButton *fw_cancelButton NS_REFINED_FOR_SWIFT;

/// 设置整体背景色
@property (nonatomic, strong, nullable) UIColor *fw_backgroundColor NS_REFINED_FOR_SWIFT;

/// 设置输入框背景色
@property (nonatomic, strong, nullable) UIColor *fw_textFieldBackgroundColor NS_REFINED_FOR_SWIFT;

/// 设置搜索图标离左侧的偏移位置,非居中时生效
@property (nonatomic, assign) CGFloat fw_searchIconOffset NS_REFINED_FOR_SWIFT;

/// 设置搜索文本离左侧图标的偏移位置
@property (nonatomic, assign) CGFloat fw_searchTextOffset NS_REFINED_FOR_SWIFT;

/// 设置TextField搜索图标(placeholder)是否居中,否则居左
@property (nonatomic, assign) BOOL fw_searchIconCenter NS_REFINED_FOR_SWIFT;

/// 强制取消按钮一直可点击,需在showsCancelButton设置之后生效。默认SearchBar失去焦点之后取消按钮不可点击
@property (nonatomic, assign) BOOL fw_forceCancelButtonEnabled NS_REFINED_FOR_SWIFT;

@end

Undocumented

  • 自定义内容边距,可调整左右距离和TextField高度,未设置时为系统默认

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets fw_contentInset;
  • 自定义取消按钮边距,未设置时为系统默认

    Declaration

    Objective-C

    @property (nonatomic) UIEdgeInsets fw_cancelButtonInset;
  • 输入框内部视图

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) UITextField *fw_textField;
  • 取消按钮内部视图,showsCancelButton开启后才存在

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly, nullable) UIButton *fw_cancelButton;
  • 设置整体背景色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *fw_backgroundColor;
  • 设置输入框背景色

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) UIColor *fw_textFieldBackgroundColor;
  • 设置搜索图标离左侧的偏移位置,非居中时生效

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_searchIconOffset;
  • 设置搜索文本离左侧图标的偏移位置

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_searchTextOffset;
  • 设置TextField搜索图标(placeholder)是否居中,否则居左

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_searchIconCenter;
  • 强制取消按钮一直可点击,需在showsCancelButton设置之后生效。默认SearchBar失去焦点之后取消按钮不可点击

    Declaration

    Objective-C

    @property (nonatomic) BOOL fw_forceCancelButtonEnabled;