1212#import " Coding_NetAPIManager.h"
1313#import " ODRefreshControl.h"
1414#import " SVPullToRefresh.h"
15+ #import " XHRealTimeBlur.h"
1516
1617#import " CSSearchModel.h"
1718
2425@interface CSSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
2526
2627@property (nonatomic , strong ) UIView *contentView;
28+ @property (nonatomic , strong ) XHRealTimeBlur *backgroundView;
2729@property (nonatomic , strong ) UIButton *btnMore;
2830@property (nonatomic , strong ) TopicHotkeyView *topicHotkeyView;
2931
@@ -41,6 +43,7 @@ - (void)initSearchResultsTableView;
4143- (void )initSearchHistoryView ;
4244- (void )didClickedMoreHotkey : (id )sender ;
4345- (void )didCLickedCleanSearchHistory : (id )sender ;
46+ - (void )didClickedContentView : (UIGestureRecognizer *)sender ;
4447@end
4548
4649@implementation CSSearchDisplayVC
@@ -51,6 +54,7 @@ - (void)setActive:(BOOL)visible animated:(BOOL)animated {
5154
5255 if (_contentView) {
5356
57+ [_backgroundView removeFromSuperview ];
5458 [_contentView removeFromSuperview ];
5559 [_searchTableView removeFromSuperview ];
5660 [super setActive: visible animated: animated];
@@ -75,14 +79,31 @@ - (void)setActive:(BOOL)visible animated:(BOOL)animated {
7579 }
7680
7781 if (!_contentView) {
82+
83+ _contentView = ({
84+
85+ UIView *view = [[UIView alloc ] init ];
86+ view.frame = CGRectMake (0 .0f , 60 .0f , kScreen_Width , kScreen_Height - 60 .0f );
87+ view.backgroundColor = [UIColor clearColor ];
88+ view.userInteractionEnabled = YES ;
89+
90+ UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc ] initWithTarget: self action: @selector (didClickedContentView: )];
91+ [view addGestureRecognizer: tapGestureRecognizer];
92+
93+ view;
94+ });
95+
96+ _backgroundView = ({
7897
79- _contentView = [[UIView alloc ] init ];
80- _contentView.frame = CGRectMake (0 .0f , 60 .0f , kScreen_Width , kScreen_Height - 60 .0f );
81- _contentView.backgroundColor = [UIColor whiteColor ];
98+ XHRealTimeBlur *blur = [[XHRealTimeBlur alloc ] initWithFrame: _contentView.frame];
99+ blur.blurStyle = XHBlurStyleTranslucentWhite;
100+ blur;
101+ });
82102
83103 [self initSubViewsInContentView ];
84104 }
85105
106+ [self .searchBar.superview addSubview: _backgroundView];
86107 [self .searchBar.superview addSubview: _contentView];
87108 [self .searchBar.superview bringSubviewToFront: _contentView];
88109 __weak typeof (self) weakSelf = self;
@@ -108,6 +129,8 @@ - (void)initSubViewsInContentView {
108129 [_btnMore addTarget: self action: @selector (didClickedMoreHotkey: ) forControlEvents: UIControlEventTouchUpInside];
109130 [_contentView addSubview: _btnMore];
110131
132+ // [_btnMore addBadgePoint:2 withPosition:BadgePositionTypeMiddle];
133+
111134 _topicHotkeyView = [[TopicHotkeyView alloc ] init ];
112135 [_contentView addSubview: _topicHotkeyView];
113136 [_topicHotkeyView mas_makeConstraints: ^(MASConstraintMaker *make) {
@@ -137,8 +160,6 @@ - (void)initSubViewsInContentView {
137160 make.width .mas_equalTo (kScreen_Width );
138161 make.height .mas_equalTo (weakSelf.topicHotkeyView .frame .size .height );
139162 }];
140- // [weakSelf.searchHistoryView setFrame:CGRectMake(weakSelf.searchHistoryView.frame.origin.x, weakSelf.topicHotkeyView.frame.origin.y + weakSelf.topicHotkeyView.frame.size.height,
141- // weakSelf.searchHistoryView.frame.size.width, weakSelf.searchHistoryView.frame.size.height)];
142163 }
143164 }];
144165}
@@ -256,6 +277,11 @@ - (void)didCLickedCleanSearchHistory:(id)sender {
256277 [self initSearchHistoryView ];
257278}
258279
280+ - (void )didClickedContentView : (UIGestureRecognizer *)sender {
281+
282+ [self .searchBar resignFirstResponder ];
283+ }
284+
259285#pragma mark -
260286#pragma mark Search Data Request
261287
0 commit comments