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/Project/Examine/ViewControllers/PBCheckTaskViewController.m | 108 +++++++++++++++++++++++++---------------------------- 1 files changed, 51 insertions(+), 57 deletions(-) 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 -- Gitblit v1.9.3