2
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#import "KBSkinCardCell.h"
|
||||
#import "KBSearchVM.h"
|
||||
#import "KBSearchThemeModel.h"
|
||||
#import "KBSkinDetailVC.h"
|
||||
|
||||
static NSString * const kResultCellId = @"KBSkinCardCell";
|
||||
|
||||
@@ -113,6 +114,17 @@ static NSString * const kResultCellId = @"KBSkinCardCell";
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
KBSearchThemeModel *model = self.resultItems[indexPath.item];
|
||||
NSString *themeId = [model.themeId stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (themeId.length == 0) { return; }
|
||||
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
|
||||
vc.themeId = themeId;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegateFlowLayout
|
||||
|
||||
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "UICollectionViewLeftAlignedLayout.h"
|
||||
#import "KBSearchVM.h"
|
||||
#import "KBShopThemeModel.h"
|
||||
#import "KBSkinDetailVC.h"
|
||||
|
||||
|
||||
static NSString * const kTagCellId = @"KBTagCell";
|
||||
@@ -137,6 +138,15 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
/// 打开皮肤详情页
|
||||
- (void)openDetailForThemeId:(NSString *)themeId {
|
||||
NSString *trim = [themeId stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
if (trim.length == 0) { return; }
|
||||
KBSkinDetailVC *vc = [[KBSkinDetailVC alloc] init];
|
||||
vc.themeId = trim;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
/// 计算“最多两行展示”的历史数据,若超出则在第二行尾部添加一个“更多”按钮(向下箭头)。
|
||||
- (NSArray<NSString *> *)currentDisplayHistory {
|
||||
if (self.historyExpanded) { return self.historyWords; }
|
||||
@@ -367,6 +377,11 @@ typedef NS_ENUM(NSInteger, KBSearchSection) {
|
||||
[self performSearch:kw];
|
||||
[self openResultForKeyword:kw];
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (indexPath.section == KBSearchSectionRecommend) {
|
||||
KBShopThemeModel *model = self.recommendedThemes[indexPath.item];
|
||||
[self openDetailForThemeId:model.themeId ?: @""];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user