2222#import " WebViewController.h"
2323#import " TweetDetailViewController.h"
2424
25+ #import " CSTopicDetailVC.h"
26+
2527#define kCellIdentifier_Search @" com.coding.search.tweet.result"
2628
27- @interface CSSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource,TopicHotkeyViewDelegate >
29+ @interface CSSearchDisplayVC () <UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource>
2830
2931@property (nonatomic , strong ) UIView *contentView;
3032@property (nonatomic , strong ) XHRealTimeBlur *backgroundView;
@@ -109,6 +111,7 @@ - (void)setActive:(BOOL)visible animated:(BOOL)animated {
109111 blur;
110112
111113 });
114+ _backgroundView.userInteractionEnabled = NO ;
112115
113116 [self initSubViewsInContentView ];
114117 }
@@ -129,10 +132,10 @@ - (void)setActive:(BOOL)visible animated:(BOOL)animated {
129132
130133- (void )initSubViewsInContentView {
131134
132- UILabel *lblHotKey = [[UILabel alloc ] initWithFrame: CGRectMake (12 .0f , 5 .0f , kScreen_Width , 30 .0f )];
135+ UILabel *lblHotKey = [[UILabel alloc ] initWithFrame: CGRectMake (12 .0f , 5 .0f , kScreen_Width , 33 .0f )];
133136 [lblHotKey setUserInteractionEnabled: YES ];
134137 [lblHotKey setText: @" 热门话题" ];
135- [lblHotKey setFont: [UIFont systemFontOfSize: 14 .0f ]];
138+ [lblHotKey setFont: [UIFont systemFontOfSize: 12 .0f ]];
136139 [lblHotKey setTextColor: [UIColor colorWithHexString: @" 0x999999" ]];
137140 [_contentView addSubview: lblHotKey];
138141
@@ -141,13 +144,29 @@ - (void)initSubViewsInContentView {
141144
142145 UIImageView *moreIconView = [[UIImageView alloc ] initWithFrame: CGRectMake (kScreen_Width - 31 .0f , 10 .0f , 20 .0f , 20 .0f )];
143146 moreIconView.image = [UIImage imageNamed: @" me_info_arrow_left" ];
147+ moreIconView.centerY = lblHotKey.centerY ;
144148 [_contentView addSubview: moreIconView];
145149
146- _topicHotkeyView = [[TopicHotkeyView alloc ] init ];
147- _topicHotkeyView.delegate = self;
150+ __weak typeof (self) weakSelf = self;
151+
152+ _topicHotkeyView = [[TopicHotkeyView alloc ] initWithFrame: CGRectMake (0 , 40 , kScreen_Width , 0 )];
153+ _topicHotkeyView.block = ^(NSDictionary *dict){
154+ [weakSelf.searchBar resignFirstResponder ];
155+
156+ CSTopicDetailVC *vc = [[CSTopicDetailVC alloc ] init ];
157+ vc.topicID = [dict[@" id" ] intValue ];
158+ [weakSelf.parentVC.navigationController pushViewController: vc animated: YES ];
159+
160+ // TODO psy
161+ // self.searchBar.text = key;
162+ // [CSSearchModel addSearchHistory:self.searchBar.text];
163+ // [self initSearchHistoryView];
164+ // [self.searchBar resignFirstResponder];
165+ //
166+ // [self initSearchResultsTableView];
167+ };
148168 [_contentView addSubview: _topicHotkeyView];
149169 [_topicHotkeyView mas_makeConstraints: ^(MASConstraintMaker *make) {
150-
151170 make.left .mas_equalTo (@0 );
152171 make.top .mas_equalTo (@40 );
153172 make.width .mas_equalTo (kScreen_Width );
@@ -156,18 +175,19 @@ - (void)initSubViewsInContentView {
156175
157176 [self initSearchHistoryView ];
158177
159- __weak typeof (self) weakSelf = self;
160178 [[Coding_NetAPIManager sharedManager ] request_TopicHotkeyWithBlock: ^(id data, NSError *error) {
161179 if (data) {
162180 NSArray *array = data;
163181 NSMutableArray *hotkeyArray = [[NSMutableArray alloc ] initWithCapacity: 6 ];
164- for (int i = 0 ; i < (array.count >= 6 ? 6 : array.count ); i++) {
165- [hotkeyArray addObject: [(NSDictionary *)array[i] objectForKey: @" name" ]];
182+ for (int i = 0 ; i < array.count ; i++) {
183+ if (i == 6 ) {
184+ break ;
185+ }
186+ [hotkeyArray addObject: array[i]];
166187 }
167188
168189 [weakSelf.topicHotkeyView setHotkeys: hotkeyArray];
169- [weakSelf.topicHotkeyView mas_remakeConstraints: ^(MASConstraintMaker *make) {
170-
190+ [weakSelf.topicHotkeyView mas_updateConstraints: ^(MASConstraintMaker *make) {
171191 make.left .mas_equalTo (@0 );
172192 make.top .mas_equalTo (@40 );
173193 make.width .mas_equalTo (kScreen_Width );
@@ -292,14 +312,15 @@ - (void)initSearchHistoryView {
292312}
293313
294314- (void )didClickedMoreHotkey : (UIGestureRecognizer *)sender {
295-
315+ [self .searchBar resignFirstResponder ];
316+
296317 RKSwipeBetweenViewControllers *nav_topic = [RKSwipeBetweenViewControllers newSwipeBetweenViewControllers ];
297318 [nav_topic.viewControllerArray addObjectsFromArray: @[[CSHotTopicVC new ],[CSMyTopicVC new ]]];
298319 nav_topic.buttonText = @[@" 热门话题" , @" 我的话题" ];
299320
300321 CATransition *transition = [CATransition animation ];
301- transition.duration = 0.3 ;
302- transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut ];
322+ transition.duration = 0.5 ;
323+ transition.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut ];
303324 transition.type = kCATransitionPush ;
304325 transition.subtype = kCATransitionFromRight ;
305326
@@ -335,15 +356,6 @@ - (void)didClickedHistory:(UIGestureRecognizer *)sender {
335356 [self initSearchResultsTableView ];
336357}
337358
338- - (void )didClickHotkey : (NSString *)key {
339- self.searchBar .text = key;
340- [CSSearchModel addSearchHistory: self .searchBar.text];
341- [self initSearchHistoryView ];
342- [self .searchBar resignFirstResponder ];
343-
344- [self initSearchResultsTableView ];
345- }
346-
347359#pragma mark -
348360#pragma mark Search Data Request
349361
0 commit comments