34 lines
775 B
Objective-C
34 lines
775 B
Objective-C
//
|
||
// KBSearchBarView.h
|
||
// keyBoard
|
||
//
|
||
// 顶部搜索栏,独立封装的 View。
|
||
// - 左侧圆角输入框,右侧搜索按钮
|
||
// - 通过 block 将搜索事件回传给 VC
|
||
//
|
||
|
||
#import <UIKit/UIKit.h>
|
||
|
||
NS_ASSUME_NONNULL_BEGIN
|
||
|
||
@interface KBSearchBarView : UIView
|
||
|
||
/// 输入框
|
||
@property (nonatomic, strong, readonly) UITextField *textField;
|
||
|
||
/// 背景视图圆角(默认 20),外部可自定义。
|
||
@property (nonatomic, assign) CGFloat bgCornerRadius;
|
||
|
||
/// 点击键盘 return 或右侧按钮时回调
|
||
@property (nonatomic, copy) void(^onSearch)(NSString *keyword);
|
||
|
||
/// 占位文字,默认“Themes”
|
||
@property (nonatomic, copy) NSString *placeholder;
|
||
|
||
/// 外部可设置关键字
|
||
- (void)updateKeyword:(NSString *)keyword;
|
||
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|