From f86647c644b10a03300906aac377505ad1c24c98 Mon Sep 17 00:00:00 2001
From: zjf <zhangjf@probim.com.cn>
Date: Mon, 13 Mar 2023 13:33:04 +0800
Subject: [PATCH] 项目搜索历史标签 及 现场 新增标签更换库  collection view 添加背景颜色 cell修改样式

---
 IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.m              |   38 +++
 IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.h          |   13 +
 IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/PBProjectSearchView.m                      |   54 +++-
 IphoneBIMe/IphoneBIMe/Classes/Project/Examine/AddViews/PBPersonChooseTableViewCell.m       |  147 +-----------
 IphoneBIMe/IphoneBIMe.xcodeproj/project.pbxproj                                            |   20 +
 IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBAddExamineViewController.m |   94 ++++----
 IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBCheckTaskViewController.m  |  108 ++++-----
 IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.h              |   18 +
 IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.m          |  151 +++++++++++++
 9 files changed, 394 insertions(+), 249 deletions(-)

diff --git a/IphoneBIMe/IphoneBIMe.xcodeproj/project.pbxproj b/IphoneBIMe/IphoneBIMe.xcodeproj/project.pbxproj
index 4f91af3..dd71f48 100644
--- a/IphoneBIMe/IphoneBIMe.xcodeproj/project.pbxproj
+++ b/IphoneBIMe/IphoneBIMe.xcodeproj/project.pbxproj
@@ -268,6 +268,8 @@
 		2CFB177E2101CC1200B6BF1A /* PBModelsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CFB177D2101CC1200B6BF1A /* PBModelsTableViewCell.m */; };
 		2CFD790624C02CA9006B6E75 /* PBInputCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CFD790524C02CA8006B6E75 /* PBInputCodeTableViewCell.m */; };
 		4C07019729B85E4000F29889 /* PBNewVehicleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C07019629B85E4000F29889 /* PBNewVehicleTableViewCell.m */; };
+		4C0701B729BED74000F29889 /* KeyWordCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0701B329BED74000F29889 /* KeyWordCell.m */; };
+		4C0701B829BED74000F29889 /* LBKeyWordLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C0701B529BED74000F29889 /* LBKeyWordLayout.m */; };
 		4C385C912988F3DF00D9F626 /* SGScanViewConfigure.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C385C742988F3DF00D9F626 /* SGScanViewConfigure.m */; };
 		4C385C922988F3DF00D9F626 /* SGScanView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C385C752988F3DF00D9F626 /* SGScanView.m */; };
 		4C385C932988F3DF00D9F626 /* SGQRCode.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 4C385C782988F3DF00D9F626 /* SGQRCode.bundle */; };
@@ -1763,6 +1765,10 @@
 		2E141B7B69B652435715D5BB /* Pods-IphoneBIMe.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IphoneBIMe.release.xcconfig"; path = "Pods/Target Support Files/Pods-IphoneBIMe/Pods-IphoneBIMe.release.xcconfig"; sourceTree = "<group>"; };
 		4C07019529B85E4000F29889 /* PBNewVehicleTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PBNewVehicleTableViewCell.h; sourceTree = "<group>"; };
 		4C07019629B85E4000F29889 /* PBNewVehicleTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PBNewVehicleTableViewCell.m; sourceTree = "<group>"; };
+		4C0701B329BED74000F29889 /* KeyWordCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyWordCell.m; sourceTree = "<group>"; };
+		4C0701B429BED74000F29889 /* LBKeyWordLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBKeyWordLayout.h; sourceTree = "<group>"; };
+		4C0701B529BED74000F29889 /* LBKeyWordLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBKeyWordLayout.m; sourceTree = "<group>"; };
+		4C0701B629BED74000F29889 /* KeyWordCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyWordCell.h; sourceTree = "<group>"; };
 		4C385C722988F3DF00D9F626 /* SGQRCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SGQRCode.h; sourceTree = "<group>"; };
 		4C385C742988F3DF00D9F626 /* SGScanViewConfigure.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGScanViewConfigure.m; sourceTree = "<group>"; };
 		4C385C752988F3DF00D9F626 /* SGScanView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SGScanView.m; sourceTree = "<group>"; };
@@ -2271,6 +2277,7 @@
 		2C2A6F0E20F8948C00218D5C /* Views */ = {
 			isa = PBXGroup;
 			children = (
+				4C0701B229BED74000F29889 /* AutoCollectView */,
 				2CBB3FC4248A45C8003D3089 /* AutoFitLabel */,
 				2C5067F720FDB30600D5F47A /* Menu */,
 				2CA07076246B991500F9D6D1 /* PBAnnotationView.h */,
@@ -4040,6 +4047,17 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
+		4C0701B229BED74000F29889 /* AutoCollectView */ = {
+			isa = PBXGroup;
+			children = (
+				4C0701B329BED74000F29889 /* KeyWordCell.m */,
+				4C0701B429BED74000F29889 /* LBKeyWordLayout.h */,
+				4C0701B529BED74000F29889 /* LBKeyWordLayout.m */,
+				4C0701B629BED74000F29889 /* KeyWordCell.h */,
+			);
+			path = AutoCollectView;
+			sourceTree = "<group>";
+		};
 		4C385C712988F3DF00D9F626 /* SGQRCode */ = {
 			isa = PBXGroup;
 			children = (
@@ -4662,6 +4680,7 @@
 				2C5067F620FD935100D5F47A /* PBMineView.m in Sources */,
 				2C66CBED216C811B0039C19A /* PBProjectPower.m in Sources */,
 				4CD610FE28C052B900BBBF67 /* PBSuperviseTableViewCell.m in Sources */,
+				4C0701B829BED74000F29889 /* LBKeyWordLayout.m in Sources */,
 				2C16401528C39A7A001DFF31 /* PBMaterialPlanModel.m in Sources */,
 				4C8488712901529C0095E7C3 /* PBScrollVpView.m in Sources */,
 				2C01A388211182F600D75B3F /* PBDocBaseController.mm in Sources */,
@@ -4748,6 +4767,7 @@
 				2C69964A2435C7820015EE17 /* PBStructureViewController.m in Sources */,
 				2C2CB6652125632400E35BB5 /* PBPersonTableViewCell.m in Sources */,
 				2CBB3FEE2493634F003D3089 /* PBCodeTableViewCell.m in Sources */,
+				4C0701B729BED74000F29889 /* KeyWordCell.m in Sources */,
 				4C90992628D80F0B004B30C4 /* IQKeyboardManager.m in Sources */,
 				2C1AC3F8211AFAE900D3C412 /* PBIssueNavModel.m in Sources */,
 				2C8DD18B247F704C009B6C26 /* JYPulleyScrollView.m in Sources */,
diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/AddViews/PBPersonChooseTableViewCell.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/AddViews/PBPersonChooseTableViewCell.m
index c0bcad1..9a65cf1 100644
--- a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/AddViews/PBPersonChooseTableViewCell.m
+++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/AddViews/PBPersonChooseTableViewCell.m
@@ -10,11 +10,11 @@
 #import "PBExamineAddModel.h"
 #import "PBPersonListView.h"
 #import "PBPersonModel.h"
-#import "MSSAutoresizeLabelFlowLayout.h"
+#import "LBKeyWordLayout.h"
+#import "KeyWordCell.h"
 #import "PBPersonListCollectionViewCell.h"
-#import "MSSAutoresizeLabelFlowConfig.h"
 static NSString *const cellId = @"cellId";
-@interface PBPersonChooseTableViewCell()<UICollectionViewDataSource,UICollectionViewDelegate, MSSAutoresizeLabelFlowLayoutDataSource,MSSAutoresizeLabelFlowLayoutDelegate>
+@interface PBPersonChooseTableViewCell()<UICollectionViewDataSource,UICollectionViewDelegate>
 @property (nonatomic,strong) UICollectionView *collection;
 @property (nonatomic,strong) NSMutableArray *data;
 //@property (nonatomic,copy) selectedHandler  handler;
@@ -25,6 +25,8 @@
 @property (nonatomic, weak) UIView *collectionBg;
 @property (nonatomic, assign) BOOL isLayout;
 @property (nonatomic, assign) CGFloat height;
+@property (strong, nonatomic) LBKeyWordLayout *layout;
+
 @end
 @implementation PBPersonChooseTableViewCell
 - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
@@ -69,28 +71,17 @@
     self.titleL = titleL;
     self.personL = personL;
     self.chooseBtn = chooseBtn;
-    
-//    UIView *collectionBg = [[UIView alloc] init];
-//    collectionBg.backgroundColor = [UIColor yellowColor];
-//    [self.contentView addSubview:collectionBg];
-//    [collectionBg mas_makeConstraints:^(MASConstraintMaker *make) {
-//        make.top.equalTo(self.contentView).offset(53);
-//        make.left.equalTo(self.contentView).offset(100);
-//        make.right.equalTo(self.contentView).offset(-20);
-//        make.height.equalTo(@1);
-//        make.bottom.equalTo(self.contentView).offset(-15);
-//    }];
+    self.layout = [[LBKeyWordLayout alloc] init];
+    self.layout.estimatedItemSize = CGSizeMake(80, 30);
+    self.layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
 
-    MSSAutoresizeLabelFlowLayout *layout = [[MSSAutoresizeLabelFlowLayout alloc]init];
-    layout.delegate = self;
-    layout.dataSource = self;
-    self.collection = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:layout];
+    self.collection = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:self.layout];
     self.collection.backgroundColor = [UIColor whiteColor];
-    self.collection.allowsMultipleSelection = YES;
+//    self.collection.allowsMultipleSelection = YES;
     self.collection.delegate = self;
     self.collection.dataSource = self;
 //    self.collection.scrollEnabled = NO;
-    [self.collection registerClass:[PBPersonListCollectionViewCell class] forCellWithReuseIdentifier:cellId];
+    [self.collection registerClass:[KeyWordCell class] forCellWithReuseIdentifier:@"KeyWordCell"];
     [self.contentView addSubview:self.collection];
     [self.collection mas_makeConstraints:^(MASConstraintMaker *make) {
 //        make.top.left.right.bottom.equalTo(collectionBg);
@@ -138,22 +129,15 @@
     [self.collection layoutIfNeeded];
     if (self.examineAddModel.personArr.count > 0) {
         [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-            make.height.equalTo(@(76));
-//            make.bottom.equalTo(self.contentView).offset(-(bottom));
+            make.height.equalTo(@(70));
         }];
     }else {
         [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
             make.height.equalTo(@(1));
-//            make.bottom.equalTo(self.contentView).offset(-(bottom));
         }];
     }
     
     self.titleL.text = examineAddModel.title;
-//    if (examineAddModel.personArr.count > 10) {
-//        self.totalNumberBtn.hidden = NO;
-//    }else {
-//        self.totalNumberBtn.hidden = YES;
-//    }
     if (examineAddModel.personArr.count > 0) {
         self.personL.textColor = PBColor(40, 58, 79);
         self.personL.text = [NSString stringWithFormat:@"已选择%zd人", examineAddModel.personArr.count];
@@ -161,117 +145,20 @@
         self.personL.textColor = PBColor(204, 204, 204);
         self.personL.text = examineAddModel.prompt;
     }
-    
-//    if (self.data.count == 0) {
-//        [self.collectionBg mas_updateConstraints:^(MASConstraintMaker *make) {
-//            make.height.equalTo(@1);
-//        }];
-//    }
-    
- 
-//    [self.collection setNeedsLayout];
-//    [self.collection layoutIfNeeded];
-    
-//    if (self.examineAddModel.personArr.count > 0) {
-//        NSLog(@"hhhhhhhhhhhhhhhhh-%f-%f",self.collection.contentSize.height,self.height);
-//        NSLog(@"wwwwwwwwwwwww-%f",self.collection.collectionViewLayout.collectionViewContentSize.height);
-//        [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-//            make.height.equalTo(@(self.collection.collectionViewLayout.collectionViewContentSize.height));
-////            make.bottom.equalTo(self.contentView).offset(-(bottom));
-//        }];
-//    }else {
-//        [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-//            make.height.equalTo(@(1));
-////            make.bottom.equalTo(self.contentView).offset(-(bottom));
-//        }];
-//    }
-    
 
-}
-
-- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
-    return 1;
 }
 
 - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
-//    if (self.data.count > 10) {
-//        return 10;
-//    }else {
-        return self.data.count;
-//    }
+    return self.data.count;
 }
 
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
-    PBPersonListCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
+    KeyWordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KeyWordCell" forIndexPath:indexPath];
+    cell.maxWidthConstraint.constant = CGRectGetWidth(collectionView.bounds) - self.layout.sectionInset.left - self.layout.sectionInset.right - cell.layoutMargins.left - cell.layoutMargins.right - 10;
+    cell.textLabel.numberOfLines = 1;
     PBPersonModel *model = self.data[indexPath.item];
-    [cell configCellWithTitle:model.RealName];
+    cell.textLabel.text = model.RealName;
     return cell;
-}
-
-- (NSString *)titleForLabelAtIndexPath:(NSIndexPath *)indexPath {
-    PBPersonModel *model = self.data[indexPath.item];
-    return model.RealName;
-}
-
-- (void)layoutFinishWithNumberOfline:(NSInteger)number {
-    NSLog(@"===-=-=-=-=-=-=-=%zd",number);
-//    static NSInteger numberCount;
-//    if (numberCount == number) {
-//        return;
-//    }
-//    numberCount = number;
-    MSSAutoresizeLabelFlowConfig *config = [MSSAutoresizeLabelFlowConfig shareConfig];
-    CGFloat h = config.contentInsets.top+config.contentInsets.bottom+config.itemHeight*number+config.lineSpace*(number-1);
-    self.height = h;
-    NSLog(@"mmmmmmmmmmmmmmmm-%f",h);
-   
-     //    [self.contentView mas_updateConstraints:^(MASConstraintMaker *make) {
-//        make.bottom.equalTo(self.collection.mas_bottom).offset(15);
-//    }];
-//    self.frame = CGRectMake(self.frame.origin.x, self.frame.origin.y, self.frame.size.width, h);
-//    [UIView animateWithDuration:0.2 animations:^{
-//        self.collection.frame = self.bounds;
-//    }];
-
-//    [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-//        make.height.equalTo(@(h));
-//    }];
-//    [self.contentView layoutIfNeeded];
-//    CGFloat botton;
-//    if (self.examineAddModel.personArr.count > 10) {
-//        botton = 15.f + 32.f;
-//        self.totalNumberBtn.hidden = NO;
-//        [self.totalNumberBtn setTitle:[NSString stringWithFormat:@"查看全部%zd个%@", self.examineAddModel.personArr.count, self.examineAddModel.title] forState:UIControlStateNormal];
-//    }else {
-//        botton = 15.f;
-//        self.totalNumberBtn.hidden = YES;
-//    }
-//    [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-//        make.bottom.equalTo(self.contentView).offset(-(botton));
-//    }];
-//    CGFloat bottom;
-//    if (self.examineAddModel.personArr.count > 10) {
-//        self.totalNumberBtn.hidden = NO;
-//        bottom = 32 + 15;
-//    }else {
-//        self.totalNumberBtn.hidden = YES;
-//        bottom = 15;
-//    }
-//    NSLog(@"======%f",h);
-//    if (h <= 0) {
-//        h = 1.f;
-//    }
-//    self.examineAddModel.height = h;
-//    [self.collection mas_updateConstraints:^(MASConstraintMaker *make) {
-//        make.height.equalTo(@(h));
-//        make.bottom.equalTo(self.contentView).offset(-(bottom));
-//    }];
-//    if (self.examineAddModel.height == 0) {
-////        self.examineAddModel.height = h;
-//        if (self.ReLoadBlock) {
-//            self.ReLoadBlock(h);
-//        }
-//    }
 }
 
 - (void)awakeFromNib {
diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBAddExamineViewController.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBAddExamineViewController.m
index 018c28e..c69c229 100644
--- a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBAddExamineViewController.m
+++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBAddExamineViewController.m
@@ -25,7 +25,6 @@
 #import "PBPersonModel.h"
 #import "PBArtifactsInfoModel.h"
 #import "PBProjectModel.h"
-#import "MSSAutoresizeLabelFlow.h"
 #import "PBTextInputTableViewCell.h"
 #import "PBTopTitleTableViewCell.h"
 #import "PBTimeChooseTableViewCell.h"
@@ -46,6 +45,8 @@
 #import "PBCheckHeaderView.h"
 #import "LXFCameraController.h"
 #import "PBVideoPlayViewController.h"
+#import "LBKeyWordLayout.h"
+#import "KeyWordCell.h"
 static NSString *const inputCellID = @"InputCellID";
 static NSString *const titleCellID = @"titleCellID";
 static NSString *const oneChooseCellID = @"oneChooseCellID";
@@ -57,7 +58,7 @@
 static NSString *const statusCellID = @"statusCellID";
 static NSString *const instructionsCellID = @"instructionsCellID";
 
-@interface PBAddExamineViewController ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate, LFImagePickerControllerDelegate>
+@interface PBAddExamineViewController ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate, LFImagePickerControllerDelegate, UICollectionViewDelegate, UICollectionViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) NSMutableArray<PBExamineAddModel *> *dataListM;
 @property (nonatomic, strong) NSDictionary *examinDetailDic;
@@ -66,8 +67,6 @@
 @property (nonatomic, strong) PBTimeChooseView *timeChooseView;
 @property (nonatomic, strong) PBEditTimeView *editTimeView;
 @property (nonatomic, strong) UIView *backgroundView;
-@property (nonatomic, strong) UIView *typeBackView;
-@property (nonatomic, strong) MSSAutoresizeLabelFlow *typeListRecordV;
 @property (nonatomic, weak) UIButton *typeListBtn;
 @property (nonatomic, strong) NSDictionary *typeDict;
 @property (nonatomic, strong) PBCheckHeaderView *tableheaderView1;
@@ -77,6 +76,9 @@
 @property (nonatomic, assign) NSInteger personIndex;
 @property (nonatomic, assign) BOOL isSupervisor;//是否为监理人
 @property (nonatomic, assign) BOOL isQualified;//是否状态为已合格
+@property (nonatomic, strong) UICollectionView *collectionView;
+@property (strong, nonatomic) LBKeyWordLayout *layout;
+@property (strong, nonatomic) NSArray *items;
 @end
 
 @implementation PBAddExamineViewController
@@ -847,11 +849,6 @@
     [self hideDropDown];
 }
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
-//    if ([NSStringFromClass([touch.view class]) isEqualToString:@"MSSAutoresizeLabelFlow"]) {
-//        return NO;
-//    } else {
-//        return YES;
-//    }
     if (touch.view == self.backgroundView) {
         return YES;
     } else {
@@ -864,36 +861,20 @@
         return;
     }
     [self.view addSubview:self.backgroundView];
-    [self.backgroundView addSubview:self.typeBackView];
-    [self.typeBackView circleViewWithRadius:6];
-    [self.typeBackView addSubview:self.typeListRecordV];
-    [UIView animateWithDuration:0.5 animations:^{
-        self.typeBackView.frame = CGRectMake(0, 0, PBScreenWidth, 176);
-        self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
-    }completion:^(BOOL finished) {
-//        self->_isShow = YES;
-        
-    }];
+    [self.view addSubview:self.collectionView];
     self.typeListBtn.enabled = NO;
     self.navigationItem.leftBarButtonItem.enabled = NO;
 }
 - (void)hideDropDown{
-    [UIView animateWithDuration:0.5 animations:^{
-        self.typeBackView.frame = CGRectMake(0, -176, PBScreenWidth, 176);
-        self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
-    }completion:^(BOOL finished) {
-        [self.backgroundView removeFromSuperview];
-        [self.typeBackView removeFromSuperview];
-        [self.typeListRecordV removeFromSuperview];
-//        self->_isShow = NO;
-    }];
+    [self.collectionView removeFromSuperview];
+    [self.backgroundView removeFromSuperview];
     self.typeListBtn.enabled = YES;
     self.navigationItem.leftBarButtonItem.enabled = YES;
 }
 - (UIView *)backgroundView {
     if (_backgroundView == nil) {
         _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, PBScreenWidth, self.view.height)];
-        _backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
+        _backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
         [_backgroundView setOpaque:NO];
         UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backTapped:)];
         tap.delegate = self;
@@ -901,30 +882,43 @@
     }
     return _backgroundView;
 }
-- (MSSAutoresizeLabelFlow *)typeListRecordV {
-    NSMutableArray *arrM = [[NSMutableArray alloc] init];
-    for (NSInteger i = 0; i < self.typeArr.count; i++) {
-        NSString *str = [self.typeArr[i] valueForKey:@"aedt_name"];
-        [arrM addObject:str];
+- (UICollectionView *)collectionView {
+    if (_collectionView == nil) {
+        NSMutableArray *arrM = [[NSMutableArray alloc] init];
+        for (NSInteger i = 0; i < self.typeArr.count; i++) {
+            NSString *str = [self.typeArr[i] valueForKey:@"aedt_name"];
+            [arrM addObject:str];
+        }
+        self.items = arrM.copy;
+        self.layout = [[LBKeyWordLayout alloc] init];
+        self.layout.estimatedItemSize = CGSizeMake(80, 30);
+        self.layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
+        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, PBScreenWidth, 200) collectionViewLayout:self.layout];
+        _collectionView.backgroundColor = [UIColor whiteColor];
+        [_collectionView registerClass:[KeyWordCell class] forCellWithReuseIdentifier:@"KeyWordCell"];
+        _collectionView.delegate = self;
+        _collectionView.dataSource = self;
     }
-    NSArray *array = arrM.copy;
-    if (_typeListRecordV == nil) {
-        _typeListRecordV = [[MSSAutoresizeLabelFlow alloc] initWithFrame:CGRectMake(0, 25, PBScreenWidth, 126) titles:array selectedHandler:^(NSUInteger index, NSString *title) {
-            self.typeDict = self.typeArr[index];
-            NSString *btnTitle = [NSString stringWithFormat:@"%@ ⋁",[self.typeDict valueForKey:@"aedt_name"]];
-            [self.typeListBtn setTitle:btnTitle forState:UIControlStateNormal];
-            [self hideDropDown];
-        }];
-    }
-    return _typeListRecordV;
+    return _collectionView;
 }
-- (UIView *)typeBackView {
-    if (_typeBackView == nil) {
-        _typeBackView = [[UIView alloc] initWithFrame:CGRectMake(0, -176, PBScreenWidth, 176)];
-        _typeBackView.backgroundColor = [UIColor whiteColor];
-    }
-    return _typeBackView;
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.items.count;
 }
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    KeyWordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KeyWordCell" forIndexPath:indexPath];
+    cell.maxWidthConstraint.constant = CGRectGetWidth(collectionView.bounds) - self.layout.sectionInset.left - self.layout.sectionInset.right - cell.layoutMargins.left - cell.layoutMargins.right - 10;
+    cell.textLabel.numberOfLines = 1;
+    cell.textLabel.text = self.items[indexPath.row];
+    return cell;
+}
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    self.typeDict = self.typeArr[indexPath.row];
+    NSString *btnTitle = [NSString stringWithFormat:@"%@ ⋁",[self.typeDict valueForKey:@"aedt_name"]];
+    [self.typeListBtn setTitle:btnTitle forState:UIControlStateNormal];
+    [self hideDropDown];
+}
+
 - (NSMutableArray *)selectedPhotos {
     if (_selectedPhotos == nil) {
         _selectedPhotos = [[NSMutableArray alloc] init];
diff --git a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBCheckTaskViewController.m b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBCheckTaskViewController.m
index 6b0eedc..09e3536 100644
--- a/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBCheckTaskViewController.m
+++ b/IphoneBIMe/IphoneBIMe/Classes/Project/Examine/ViewControllers/PBCheckTaskViewController.m
@@ -26,20 +26,21 @@
 #import "PBTimeChooseTableViewCell.h"
 #import "PBPersonChooseTableViewCell.h"
 #import "PBArtifactsListTableViewCell.h"
-#import "MSSAutoresizeLabelFlow.h"
 #import "PBRecordViewController.h"
 #import "PBPersonListViewController.h"
 #import "PBSelectedPersonController.h"
 #import "PBEAddImageView.h"
 #import "PBCheckHeaderView.h"
 #import "PBVideoPlayViewController.h"
+#import "LBKeyWordLayout.h"
+#import "KeyWordCell.h"
 static NSString *const inputCellID = @"InputCellID";
 static NSString *const titleCellID = @"titleCellID";
 static NSString *const timeChooseCellID = @"timeChooseCellID";
 static NSString *const personCellID = @"personCellID";
 static NSString *const listCellID = @"listCellID";
 
-@interface PBCheckTaskViewController ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate>
+@interface PBCheckTaskViewController ()<UITableViewDelegate, UITableViewDataSource, UIGestureRecognizerDelegate, UICollectionViewDelegate, UICollectionViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) NSMutableArray<PBExamineAddModel *> *dataListM;
 @property (nonatomic, strong) NSDictionary *examinDetailDic;
@@ -51,10 +52,12 @@
 @property (nonatomic, strong) NSDictionary *typeDict;
 @property (nonatomic, strong) PBComponentHierarchyView *componentHierarchyView;
 @property (nonatomic, strong) UIView *backgroundView;
-@property (nonatomic, strong) UIView *typeBackView;
-@property (nonatomic, strong) MSSAutoresizeLabelFlow *typeListRecordV;
 @property (nonatomic, assign) BOOL isCheck;
 @property (nonatomic, strong) PBCheckHeaderView *tableheaderView1;
+@property (nonatomic, strong) UICollectionView *collectionView;
+@property (strong, nonatomic) LBKeyWordLayout *layout;
+@property (strong, nonatomic) NSArray *items;
+
 @end
 
 @implementation PBCheckTaskViewController
@@ -571,11 +574,6 @@
     [self hideDropDown];
 }
 - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
-//    if ([NSStringFromClass([touch.view class]) isEqualToString:@"MSSAutoresizeLabelFlow"]) {
-//        return NO;
-//    } else {
-//        return YES;
-//    }
     if (touch.view == self.backgroundView) {
         return YES;
     } else {
@@ -588,36 +586,20 @@
         return;
     }
     [self.view addSubview:self.backgroundView];
-    [self.backgroundView addSubview:self.typeBackView];
-    [self.typeBackView circleViewWithRadius:6];
-    [self.typeBackView addSubview:self.typeListRecordV];
-    [UIView animateWithDuration:0.5 animations:^{
-        self.typeBackView.frame = CGRectMake(0, 0, PBScreenWidth, 176);
-        self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
-    }completion:^(BOOL finished) {
-//        self->_isShow = YES;
-        
-    }];
+    [self.view addSubview:self.collectionView];
     self.typeListBtn.enabled = NO;
     self.navigationItem.leftBarButtonItem.enabled = NO;
 }
 - (void)hideDropDown{
-    [UIView animateWithDuration:0.5 animations:^{
-        self.typeBackView.frame = CGRectMake(0, -176, PBScreenWidth, 176);
-        self.backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
-    }completion:^(BOOL finished) {
-        [self.backgroundView removeFromSuperview];
-        [self.typeBackView removeFromSuperview];
-        [self.typeListRecordV removeFromSuperview];
-//        self->_isShow = NO;
-    }];
+    [self.collectionView removeFromSuperview];
+    [self.backgroundView removeFromSuperview];
     self.typeListBtn.enabled = YES;
     self.navigationItem.leftBarButtonItem.enabled = YES;
 }
 - (UIView *)backgroundView {
     if (_backgroundView == nil) {
         _backgroundView = [[UIView alloc] initWithFrame:CGRectMake(0 , 0, PBScreenWidth, self.view.height)];
-        _backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
+        _backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
         [_backgroundView setOpaque:NO];
         UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backTapped:)];
         tap.delegate = self;
@@ -625,36 +607,48 @@
     }
     return _backgroundView;
 }
-- (MSSAutoresizeLabelFlow *)typeListRecordV {
-    NSMutableArray *arrM = [[NSMutableArray alloc] init];
-    for (NSInteger i = 0; i < self.typeArr.count; i++) {
-        NSString *str = [self.typeArr[i] valueForKey:@"aedt_name"];
-        [arrM addObject:str];
-    }
-    NSArray *array = arrM.copy;
-    if (_typeListRecordV == nil) {
-        _typeListRecordV = [[MSSAutoresizeLabelFlow alloc] initWithFrame:CGRectMake(0, 25, PBScreenWidth, 126) titles:array selectedHandler:^(NSUInteger index, NSString *title) {
-            __weak typeof(self) weakSelf = self;
-            NSDictionary *typeDic = self.typeArr[index];
-            NSString *guidStr = [typeDic valueForKey:@"aedt_guid"];
-            NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init];
-            [dictM setValue:guidStr forKey:@"aedt_guid"];
-            [dictM setValue:@"3" forKey:@"modify_flag"];
-            PBExamineAddModel *examineAddModel = self.dataListM[8];
-            examineAddModel.dataDict = typeDic;
-            [weakSelf ModifyMissionInfoWithData:dictM andIndexPath:nil andOriginalData:nil];
-            [self hideDropDown];
-        }];
-    }
-    return _typeListRecordV;
+- (UICollectionView *)collectionView {
+    if (_collectionView == nil) {
+        NSMutableArray *arrM = [[NSMutableArray alloc] init];
+        for (NSInteger i = 0; i < self.typeArr.count; i++) {
+            NSString *str = [self.typeArr[i] valueForKey:@"aedt_name"];
+            [arrM addObject:str];
+        }
+        self.items = arrM.copy;
+        self.layout = [[LBKeyWordLayout alloc] init];
+        self.layout.estimatedItemSize = CGSizeMake(80, 30);
+        self.layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
+        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, PBScreenWidth, 200) collectionViewLayout:self.layout];
+        [_collectionView registerClass:[KeyWordCell class] forCellWithReuseIdentifier:@"KeyWordCell"];
+        _collectionView.delegate = self;
+        _collectionView.dataSource = self;
+     }
+    return _collectionView;
+ }
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.items.count;
 }
-- (UIView *)typeBackView {
-    if (_typeBackView == nil) {
-        _typeBackView = [[UIView alloc] initWithFrame:CGRectMake(0, -176, PBScreenWidth, 176)];
-        _typeBackView.backgroundColor = [UIColor whiteColor];
-    }
-    return _typeBackView;
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    KeyWordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KeyWordCell" forIndexPath:indexPath];
+    cell.maxWidthConstraint.constant = CGRectGetWidth(collectionView.bounds) - self.layout.sectionInset.left - self.layout.sectionInset.right - cell.layoutMargins.left - cell.layoutMargins.right - 10;
+    cell.textLabel.numberOfLines = 1;
+    cell.textLabel.text = self.items[indexPath.row];
+    return cell;
 }
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    __weak typeof(self) weakSelf = self;
+    NSDictionary *typeDic = self.typeArr[indexPath.row];
+    NSString *guidStr = [typeDic valueForKey:@"aedt_guid"];
+    NSMutableDictionary *dictM = [[NSMutableDictionary alloc] init];
+    [dictM setValue:guidStr forKey:@"aedt_guid"];
+    [dictM setValue:@"3" forKey:@"modify_flag"];
+    PBExamineAddModel *examineAddModel = self.dataListM[8];
+    examineAddModel.dataDict = typeDic;
+    [weakSelf ModifyMissionInfoWithData:dictM andIndexPath:nil andOriginalData:nil];
+    [self hideDropDown];
+}
+
 /*
 #pragma mark - Navigation
 
diff --git a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.h b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.h
new file mode 100644
index 0000000..976945a
--- /dev/null
+++ b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.h
@@ -0,0 +1,18 @@
+//
+//  KeyWordCell.h
+//  IphoneBIMe
+//
+//  Created by ZhangJF on 2023/3/9.
+//  Copyright © 2023 ProBIM. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface KeyWordCell : UICollectionViewCell
+@property (weak, nonatomic) UILabel *textLabel;
+@property (weak, nonatomic) NSLayoutConstraint *maxWidthConstraint;
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.m b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.m
new file mode 100644
index 0000000..429501b
--- /dev/null
+++ b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/KeyWordCell.m
@@ -0,0 +1,38 @@
+//
+//  KeyWordCell.m
+//  IphoneBIMe
+//
+//  Created by ZhangJF on 2023/3/9.
+//  Copyright © 2023 ProBIM. All rights reserved.
+//
+
+#import "KeyWordCell.h"
+
+@implementation KeyWordCell
+- (instancetype)initWithFrame:(CGRect)frame {
+    if (self = [super initWithFrame:frame]) {
+        [self setupUI];
+    }
+    return self;
+}
+- (void)setupUI {
+    self.backgroundColor = [UIColor colorWithRed:229 / 255.0 green:239 / 255.0 blue:250 / 255.0 alpha:1.0];
+    UILabel *label = [[UILabel alloc] init];
+    label.font = [UIFont systemFontOfSize:14];
+    label.textColor = [UIColor colorWithRed:0 / 255.0 green:122 / 255.0 blue:255 / 255.0 alpha:1.0];
+    self.textLabel = label;
+    [self.contentView addSubview:self.textLabel];
+    [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.equalTo(self.contentView).offset(5);
+        make.bottom.equalTo(self.contentView).offset(-5);
+        make.left.equalTo(self.contentView).offset(10);
+        make.right.equalTo(self.contentView).offset(-10);
+    }];
+}
+
+- (void)layoutSubviews
+{
+    [super layoutSubviews];
+    self.layer.cornerRadius = 6.0f;
+}
+@end
diff --git a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.h b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.h
new file mode 100644
index 0000000..d04e3c9
--- /dev/null
+++ b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.h
@@ -0,0 +1,13 @@
+//
+//  LBKeyWordLayout.h
+//  IphoneBIMe
+//
+//  Created by ZhangJF on 2023/3/9.
+//  Copyright © 2023 ProBIM. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface LBKeyWordLayout : UICollectionViewFlowLayout
+
+@end
diff --git a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.m b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.m
new file mode 100644
index 0000000..d8573df
--- /dev/null
+++ b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/AutoCollectView/LBKeyWordLayout.m
@@ -0,0 +1,151 @@
+//
+//  LBKeyWordLayout.m
+//  IphoneBIMe
+//
+//  Created by ZhangJF on 2023/3/9.
+//  Copyright © 2023 ProBIM. All rights reserved.
+//
+#import "LBKeyWordLayout.h"
+
+@interface LBKeyWordLayout()
+@property (strong, nonatomic) NSCache *cache;
+@end
+
+@implementation LBKeyWordLayout
+
+- (void)prepareLayout
+{
+    [super prepareLayout];
+    self.cache = [NSCache new];
+}
+
+- (void)invalidateLayout
+{
+    [super invalidateLayout];
+    self.cache = [NSCache new];
+}
+
+- (BOOL)shouldInvalidateLayoutForPreferredLayoutAttributes:(UICollectionViewLayoutAttributes *)preferredAttributes withOriginalAttributes:(UICollectionViewLayoutAttributes *)originalAttributes
+{
+    return YES;
+}
+
+- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
+{
+    return YES;
+}
+
+- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect
+{
+    NSArray<UICollectionViewLayoutAttributes *> *attributes = [super layoutAttributesForElementsInRect:rect].copy;
+    return [self layoutAttributesForElements:attributes];
+}
+
+- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath
+{
+    return [self attributesAtIndexPath:indexPath];
+}
+
+#pragma mark - Private
+
+- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElements:(NSArray<UICollectionViewLayoutAttributes *> *)attributes
+{
+    NSMutableArray<UICollectionViewLayoutAttributes *> *alignedAttributes = [NSMutableArray new];
+    
+    for (UICollectionViewLayoutAttributes *item in attributes) {
+        if(item.representedElementKind != nil) {
+            [alignedAttributes addObject:item];
+        } else {
+            [alignedAttributes addObject:[self layoutAttributesForItem:item atIndexPath:item.indexPath]];
+        }
+    }
+    
+    return alignedAttributes.copy;
+}
+
+- (UICollectionViewLayoutAttributes *)layoutAttributesForItem:(UICollectionViewLayoutAttributes *)attributes atIndexPath:(NSIndexPath *)indexPath
+{
+    return [self attributes:attributes atIndexPath:indexPath];
+}
+
+- (UICollectionViewLayoutAttributes *)attributesAtIndexPath:(NSIndexPath *)indexPath
+{
+    UICollectionViewLayoutAttributes *attributes = [super layoutAttributesForItemAtIndexPath:indexPath].copy;
+    return [self attributes:attributes atIndexPath:indexPath];
+}
+
+- (UICollectionViewLayoutAttributes *)attributes:(UICollectionViewLayoutAttributes *)attributes atIndexPath:(NSIndexPath *)indexPath
+{
+    if ([self.cache objectForKey:indexPath]) {
+        return [self.cache objectForKey:indexPath];
+    }
+    
+    NSMutableArray *itemsInRow = [NSMutableArray array];
+    
+    const NSInteger totalInSection = [self.collectionView numberOfItemsInSection:indexPath.section];
+    const CGFloat width = CGRectGetWidth(self.collectionView.bounds);
+    const CGRect rowFrame = CGRectMake(0, CGRectGetMinY(attributes.frame), width, CGRectGetHeight(attributes.frame));
+    
+    // Go forward to the end or the row or section items
+    NSInteger index = indexPath.row;
+    while(index++ < totalInSection - 1) {
+        
+        UICollectionViewLayoutAttributes *next = [super layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:index
+                                                                                                               inSection:indexPath.section]].copy;
+        
+        if (!CGRectIntersectsRect(next.frame, rowFrame)) {
+            break;
+        }
+        [itemsInRow addObject:next];
+    }
+    
+    // Current item
+    [itemsInRow addObject:attributes];
+    
+    // Go backward to the start of the row or first item
+    index = indexPath.row;
+    while (index-- > 0) {
+        
+        UICollectionViewLayoutAttributes *prev = [super layoutAttributesForItemAtIndexPath:[NSIndexPath indexPathForItem:index
+                                                                                                               inSection:indexPath.section]].copy;
+        
+        if (!CGRectIntersectsRect(prev.frame, rowFrame)) {
+            break;
+        }
+        [itemsInRow addObject:prev];
+    }
+    
+    // Total items width include spacings
+    CGFloat totalWidth = self.minimumInteritemSpacing * (itemsInRow.count - 1);
+    for (UICollectionViewLayoutAttributes *item in itemsInRow) {
+        totalWidth += CGRectGetWidth(item.frame);
+    }
+    
+    // Correct sorting in row
+    [itemsInRow sortUsingComparator:^NSComparisonResult(UICollectionViewLayoutAttributes *obj1, UICollectionViewLayoutAttributes *obj2) {
+        return obj1.indexPath.row > obj2.indexPath.row;
+    }];
+    
+    CGRect rect = CGRectZero;
+    for (UICollectionViewLayoutAttributes *item in itemsInRow) {
+        
+        CGRect frame = item.frame;
+        CGFloat x = frame.origin.x;
+        
+        if (CGRectIsEmpty(rect)) {
+           x = self.sectionInset.left;
+        } else {
+           x = CGRectGetMaxX(rect) + self.minimumInteritemSpacing;
+        }
+        
+        frame.origin.x = x;
+        item.frame = frame;
+        rect = frame;
+        
+        [self.cache setObject:item forKey:item.indexPath];
+    }
+    
+    [self.cache setObject:attributes forKey:indexPath];
+    return attributes;
+}
+@end
diff --git a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/PBProjectSearchView.m b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/PBProjectSearchView.m
index bb0ed23..f5bc298 100644
--- a/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/PBProjectSearchView.m
+++ b/IphoneBIMe/IphoneBIMe/Classes/ProjectList/Views/PBProjectSearchView.m
@@ -7,15 +7,18 @@
 //
 
 #import "PBProjectSearchView.h"
-#import "MSSAutoresizeLabelFlow.h"
 #import "PBProjectTableViewCell.h"
 #import "PBProjectModel.h"
 #import "PBTabBarController.h"
-@interface PBProjectSearchView()<UISearchBarDelegate, UITableViewDataSource, UITableViewDelegate>
-@property(nonatomic,strong)MSSAutoresizeLabelFlow *historicalRecordV;
+#import "LBKeyWordLayout.h"
+#import "KeyWordCell.h"
+@interface PBProjectSearchView()<UISearchBarDelegate, UITableViewDataSource, UITableViewDelegate, UICollectionViewDelegate, UICollectionViewDataSource>
 @property (nonatomic, strong) UITableView *tableView;
 @property (nonatomic, strong) NSArray *dataList;
 @property (nonatomic, weak) UISearchBar *searchBar;
+@property (nonatomic, strong) UICollectionView *collectionView;
+@property (strong, nonatomic) LBKeyWordLayout *layout;
+@property (strong, nonatomic) NSArray *items;
 @end
 @implementation PBProjectSearchView
 - (instancetype)initWithFrame:(CGRect)frame {
@@ -87,13 +90,21 @@
         make.right.equalTo(self).offset(-18);
         make.size.mas_equalTo(CGSizeMake(24, 24));
     }];
-    NSArray *array = [self readSearchHistory];
-    _historicalRecordV = [[MSSAutoresizeLabelFlow alloc] initWithFrame:CGRectMake(0, 150, PBScreenWidth, 200) titles:array selectedHandler:^(NSUInteger index, NSString *title) {
-        NSLog(@"%@",title);
-        self.searchBar.text = title;
-        [self searchActionWithTitle:title];
-    }];
-    [self addSubview:_historicalRecordV];
+    self.items = [self readSearchHistory];
+//    _historicalRecordV = [[MSSAutoresizeLabelFlow alloc] initWithFrame:CGRectMake(0, 150, PBScreenWidth, 200) titles:array selectedHandler:^(NSUInteger index, NSString *title) {
+//        NSLog(@"%@",title);
+//        self.searchBar.text = title;
+//        [self searchActionWithTitle:title];
+//    }];
+    self.layout = [[LBKeyWordLayout alloc] init];
+    self.layout.estimatedItemSize = CGSizeMake(80, 30);
+    self.layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
+    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 150, PBScreenWidth, 400) collectionViewLayout:self.layout];
+    self.collectionView.backgroundColor = [UIColor whiteColor];
+    [self.collectionView registerClass:[KeyWordCell class] forCellWithReuseIdentifier:@"KeyWordCell"];
+    self.collectionView.delegate = self;
+    self.collectionView.dataSource = self;
+    [self addSubview:self.collectionView];
     [self addSubview:self.tableView];
     self.tableView.hidden = YES;
 }
@@ -110,7 +121,8 @@
     }
     [arrM insertObject:title atIndex:0];
     [self writeSearchHistoryWithData:arrM.copy];
-    [self.historicalRecordV reloadAllWithTitles:arrM.copy];
+    self.items = arrM.copy;
+    [self.collectionView reloadData];
 }
 - (void)backActon {
     if (self.cancelSearchBlock) {
@@ -219,7 +231,8 @@
     NSString *documentPath = [documents stringByAppendingPathComponent:@"searchHistory.plist"];
     NSFileManager *fileManager = [NSFileManager defaultManager];
     [fileManager removeItemAtPath:documentPath error:nil];
-    [self.historicalRecordV reloadAllWithTitles:@[]];
+    self.items = @[];
+    [self.collectionView reloadData];
 }
 #pragma mark - 插入本地历史记录
 - (void)writeSearchHistoryWithData:(NSArray *)history {
@@ -228,6 +241,23 @@
     NSString *documentPath = [documents stringByAppendingPathComponent:@"searchHistory.plist"];
     [history writeToFile:documentPath atomically:YES];
 }
+#pragma mark - UICollectionView
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
+    return self.items.count;
+}
+
+- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
+    KeyWordCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"KeyWordCell" forIndexPath:indexPath];
+    cell.maxWidthConstraint.constant = CGRectGetWidth(collectionView.bounds) - self.layout.sectionInset.left - self.layout.sectionInset.right - cell.layoutMargins.left - cell.layoutMargins.right - 10;
+    cell.textLabel.numberOfLines = 1;
+    cell.textLabel.text = self.items[indexPath.row];
+    return cell;
+}
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
+    self.searchBar.text = self.items[indexPath.row];
+    [self searchActionWithTitle:self.items[indexPath.row]];
+}
+
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

--
Gitblit v1.9.3