|
|
@@ -15,7 +15,8 @@
|
|
|
#import "JXEpisodeInfo.h"
|
|
|
#import "GuestHelper.h"
|
|
|
#import "JXDetailViewController.h" // Added for detail view
|
|
|
-
|
|
|
+#import "SearchCommonBarView.h"
|
|
|
+#import "JXSearchViewController.h"
|
|
|
// 复用标识符
|
|
|
static NSString * const kDramaCellIdentifier = @"JXShortDramaCell";
|
|
|
|
|
|
@@ -37,6 +38,7 @@ static NSString * const kDramaCellIdentifier = @"JXShortDramaCell";
|
|
|
@property (nonatomic, assign) BOOL hasMoreData;
|
|
|
@property (nonatomic, assign) BOOL hasUserVisited; // 用户是否已访问过
|
|
|
@property (nonatomic, assign) BOOL isFirstLoad; // 是否首次加载
|
|
|
+@property (nonatomic, strong) SearchCommonBarView *searchBar;
|
|
|
|
|
|
@end
|
|
|
|
|
|
@@ -106,6 +108,8 @@ static NSString * const kDramaCellIdentifier = @"JXShortDramaCell";
|
|
|
#pragma mark - UI设置
|
|
|
|
|
|
- (void)setupUI {
|
|
|
+
|
|
|
+
|
|
|
// 创建FlowLayout(垂直分页)
|
|
|
self.flowLayout = [[UICollectionViewFlowLayout alloc] init];
|
|
|
self.flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
|
|
|
@@ -135,8 +139,33 @@ static NSString * const kDramaCellIdentifier = @"JXShortDramaCell";
|
|
|
action:@selector(handleRefresh)
|
|
|
forControlEvents:UIControlEventValueChanged];
|
|
|
[self.collectionView addSubview:self.refreshControl];
|
|
|
+
|
|
|
+
|
|
|
+ self.searchBar = [[SearchCommonBarView alloc] init];
|
|
|
+// self.searchBar.bgView.backgroundColor = [UIColor clearColor];
|
|
|
+// self.searchBar.searchBgView.backgroundColor = [UIColor clearColor];
|
|
|
+ self.searchBar.backgroundColor = [UIColor clearColor];
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ self.searchBar.searchAction = ^(NSString * _Nonnull text) {
|
|
|
+ [weakSelf performSearchWithKeyword:text];
|
|
|
+ };
|
|
|
+ [self.view addSubview:self.searchBar];
|
|
|
+ [self.view bringSubviewToFront:self.searchBar];
|
|
|
+ [self.searchBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
|
|
|
+ make.left.right.equalTo(self.view);
|
|
|
+ make.height.mas_equalTo(44);
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+- (void)performSearchWithKeyword:(NSString *)keyword {
|
|
|
+ if (keyword.length == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ JXSearchViewController *vc = [[JXSearchViewController alloc] initWithKeyword:keyword];
|
|
|
+ [self.navigationController pushViewController:vc animated:YES];
|
|
|
}
|
|
|
-
|
|
|
#pragma mark - 数据加载
|
|
|
|
|
|
- (void)loadInitialData {
|