BBASearchTextField.h
3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//
// BBASearchTextField.h
// BaiduBoxApp
//
// Created by Haoyang XIN on 13/06/2017.
// Copyright © 2017 Baidu. All rights reserved.
//
#import <BBAUIKit/BBATextField.h>
#define SearchTextFieldViewFrame CGRectMake(0.f, 25, [BBACommonUIParams applicationFrameWidth], 49)
#define SearchTextFieldLeftLogoBaiduImage [UIImage imageNamed:@"search_text_field_baidu_logo"]
#define SearchTextFieldLeftLogoFeedImage SearchTextFieldLeftLogoBaiduImage
extern const CGFloat kBBASearchTextFieldRightViewMarginLeftSide;
extern const CGFloat kBBASearchTextFieldRightViewMarginRightSide;
extern const CGFloat kBBASearchTextFieldRightViewMarginRightBound;
extern const CGFloat kBBASearchTextFieldRightViewExtraImageOffset;
extern NSString *const BBARedPointShouldUpdateNotification;
typedef NS_OPTIONS(NSUInteger, TSearchTextFieldRightViewOption)
{
ESearchTextFieldRightViewOptionNone = 0,
ESearchTextFieldRightViewContentVoiceSearch = 1 << 0,
ESearchTextFieldRightViewContentImageSearch = 1 << 1,
ESearchTextFieldRightViewContentRefreshSearch = 1 << 2,
// ESearchTextFieldRightViewContentMoreMenu = 1 << 2,
};
@protocol BBASearchBoxProtocol <NSObject>
@optional
/*!
* @description 根据业务调用插件(插件需要一些业务相关的参数)并生成语音按钮实例.
* @return 语音按钮的实例(Browser/首页组件使用)
*/
- (UIView *)generateVoiceButton;
/// 调起多模图搜插件,Browser/首页组件使用 是否需要"点击后去除飘新红点"的UBC打点
- (void)imageSearchButtonClicked:(id)sender needPoint:(BOOL)needPoint;
/// 调起更多按钮点击事件,Browser组件使用
- (void)moreMenuButtonClicked:(id)sender;
/// 调起刷新按钮点击事件,Browser组件使用
- (void)refreshButtonClicked:(id)sender;
/// 调起停止按钮点击事件,Browser组件使用
- (void)stopButtonClicked:(id)sender;
/// 激活搜索框.
- (void)activeTextField;
@end
@interface BBASearchTextField : BBATextField
/// 搜索框Delegate
@property (nonatomic, weak) id<BBASearchBoxProtocol> searchBoxDelegate;
/// 搜索框左侧图标
@property (nonatomic, strong, readonly) UIImageView *leftLogoImageView;
/// 搜索框图搜图标
@property (nonatomic, strong, readonly) UIButton *imageSearchButton;
/// 设置搜索框左侧图标
- (UIImageView *)setUpLeftLogoViewWithImage:(UIImage *)image;
/// 设置搜索框左侧logo
- (void)setLeftLogoWithImageURL:(NSString *)imageURL;
/// 移除搜索框左侧图标,首页组件使用
- (void)removeLeftLogoImage;
/**
更新框图搜图标(适用于首页皮肤更改时)
@param skinMode 是否在使用皮肤模式下
*/
- (void)updateSearchButtonImageInUISkinMode:(BOOL)skinMode;
/**
初始化搜索框方法
@param searchTextFieldViewRightViewOption 搜索框右侧视图类型
@param rightMargin 右侧间距
@param extraImageIconLeftPadding 左边填充距离
@param shouldShowRedPoint 是否展示红点
@return 搜索框
*/
- (UIView *)buildTextFieldRightViewWithOption:(TSearchTextFieldRightViewOption)searchTextFieldViewRightViewOption
rightMargin:(CGFloat)rightMargin
extraImageIconLeftPadding:(CGFloat)extraImageIconLeftPadding
shouldShowRedPoint:(BOOL)shouldShowRedPoint;
/**
初始化搜索框便捷方法
@param searchTextFieldViewRightViewOption 搜索框右侧视图类型
@param shouldShowRedPoint 是否展示红点
@return 搜索框
*/
- (UIView *)buildTextFieldRightViewWithOption:(TSearchTextFieldRightViewOption)searchTextFieldViewRightViewOption
shouldShowRedPoint:(BOOL)shouldShowRedPoint;
/// 更新刷新按钮的状态
- (void)showRefreshBtn;
/// 显示停止加载按钮
- (void)showStopBtn;
@end