// // InstallReceiptDetailVC.m // IBOSS // // Created by apple on 16/1/8. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved. // // 功能描述:安装回执明细视图控制器 #import "InstallReceiptDetailVC.h" #import "InstallReceiptDetailCell.h" #import "DKCamera.h" #import "DKUICollectionViewCell.h" #import "DateFormat.h" #import "InstallReceiptDetailModel.h" #define kTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize] @interface InstallReceiptDetailVC () { UIView *contentView; UIScrollView *scroll; UIView *vPosition; NSInteger imagesHeight; NSInteger posHeight; DateFormat* dateformat; NSArray *imageArr; } @end @implementation InstallReceiptDetailVC @synthesize vCustomTableView; #pragma mark - 公共函数 /** 视图加载函数 */ - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"安装回执明细"; _dataList = [[NSMutableArray alloc]init]; _dataHead = [[NSMutableArray alloc]init]; dateformat = [[DateFormat alloc]init]; _assets = [[NSMutableArray alloc]init]; [self initNavUI]; [self initData]; } /** 安全区视图发生变化 */ -(void)viewSafeAreaInsetsDidChange{ scroll.frame = self.view.safeAreaLayoutGuide.layoutFrame; [super viewSafeAreaInsetsDidChange]; } /** 初始化collection view */ - (void)setupCollectionView{ UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.itemSize = CGSizeMake(85, 85); flowLayout.minimumInteritemSpacing = 5; flowLayout.minimumLineSpacing = 10; flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; flowLayout.sectionInset = UIEdgeInsetsMake(7, 20, 0, 20); self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout]; self.collectionView.backgroundColor = [UIColor clearColor]; self.collectionView.dataSource = self; self.collectionView.delegate = self; [self.collectionView registerNib:[UINib nibWithNibName:@"DKUICollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"DKUICollectionViewCell"]; [contentView addSubview:self.collectionView]; } #pragma mark - 委托函数 /** 分区数 @param tableView <#tableView description#> @return <#return value description#> */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [_dataList count]; } /** table view行数 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } /** 获取tableview cell @param tableView <#tableView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *identifier = @"InstallReceiptDetailCell"; InstallReceiptDetailCell* cell=(InstallReceiptDetailCell*)[tableView dequeueReusableCellWithIdentifier:identifier]; if(cell == nil){ NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"InstallReceiptDetailCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; vCustomTableView.rowHeight = UITableViewAutomaticDimension; cell.frame = CGRectMake(cell.frame.origin.x, cell.frame.origin.y,self.view.bounds.size.width , cell.frame.size.height); } NSUInteger row = [indexPath section]; cell.layer.cornerRadius = CornerRadius; cell.layer.backgroundColor = [UIColor whiteColor].CGColor; cell.layer.masksToBounds = YES; [cell setInstallReceiptDetailInfo:_dataList[row]]; return cell; } /** tableview 分区的间隔高度 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 10; } /** tableview的分区视图 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView* myView = [[UIView alloc]init]; myView.backgroundColor = [UIColor clearColor]; return myView; } /** collection view的分区数 @param pickerBrowser <#pickerBrowser description#> @return <#return value description#> */ - (NSInteger)numberOfSectionInPhotosInPickerBrowser:(DKPhotoPickerBrowserViewController *)pickerBrowser{ return 1; } /** collection view的项数 @param photoBrowser <#photoBrowser description#> @param section <#section description#> @return <#return value description#> */ - (NSInteger)photoBrowser:(DKPhotoPickerBrowserViewController *)photoBrowser numberOfItemsInSection:(NSUInteger)section{ return [self.assets count]; } /** collection view的照片放大函数 @param pickerBrowser <#pickerBrowser description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (DKPhotoPickerBrowserPhoto *)photoBrowser:(DKPhotoPickerBrowserViewController *)pickerBrowser photoAtIndexPath:(NSIndexPath *)indexPath{ id imageObj = [self.assets objectAtIndex:indexPath.item]; DKPhotoPickerBrowserPhoto *photo = [DKPhotoPickerBrowserPhoto photoAnyImageObjWith:imageObj]; // 包装下imageObj 成 DKPhotoPickerBrowserPhoto 传给数据源 DKUICollectionViewCell *cell = (DKUICollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath]; // 缩略图 photo.thumbImage = cell.imageView.image; return photo; } /** collection view的分区数 @param collectionView <#collectionView description#> @return <#return value description#> */ - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{ return 1; } /** collection view的项数 @param collectionView <#collectionView description#> @param section <#section description#> @return <#return value description#> */ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{ return [self.assets count]; } /** collection view cell @param collectionView <#collectionView description#> @param indexPath <#indexPath description#> @return <#return value description#> */ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{ DKUICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"DKUICollectionViewCell" forIndexPath:indexPath]; // 判断类型来获取Image DKPhotoAssets *asset = self.assets[indexPath.item]; if ([asset isKindOfClass:[DKPhotoAssets class]]) { cell.imageView.image = asset.thumbImage; } else if ([asset isKindOfClass:[NSString class]]){ [cell.imageView sd_setImageWithURL:[NSURL URLWithString:(NSString *)asset] placeholderImage:[UIImage imageNamed:@"wallpaper_placeholder"]]; } else if([asset isKindOfClass:[UIImage class]]){ cell.imageView.image = (UIImage *)asset; } else if ([asset isKindOfClass:[DKCamera class]]){ cell.imageView.image = [asset thumbImage]; } return cell; } /** collection view的点击事件 @param collectionView <#collectionView description#> @param indexPath <#indexPath description#> */ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ DKUICollectionViewCell *cell = (DKUICollectionViewCell *)[self.collectionView cellForItemAtIndexPath:indexPath]; // 图片游览器 DKPhotoPickerBrowserViewController *pickerBrowser = [[DKPhotoPickerBrowserViewController alloc] init]; // 传入点击图片View的话,会有微信朋友圈照片的风格 pickerBrowser.toView = cell.imageView; // 数据源/delegate pickerBrowser.delegate = self; pickerBrowser.dataSource = self; // 是否可以删除照片 pickerBrowser.editing = NO; // 当前选中的值 pickerBrowser.currentIndexPath = [NSIndexPath indexPathForItem:indexPath.row inSection:0]; // 展示控制器 [pickerBrowser show]; } #pragma mark - 私有函数 /** 返回函数 */ - (void)goBack { [self.navigationController popViewControllerAnimated:YES]; } /** 初始化返回按钮UI */ - (void)initNavUI{ UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:@"icon_back"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; button.frame = CGRectMake(0, 0,45,22); UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.leftBarButtonItem = menuButton; } /** 初始化地图位置ui @param posvalue <#posvalue description#> */ - (void)initPositionUI:(NSString* )posvalue{ if(posvalue == nil|| [posvalue isEqualToString:@""]){ posHeight = 0; return; } posHeight = 31; vPosition = [UIView new]; if(imageArr != nil && imageArr.count > 0){ vPosition.frame = CGRectMake(0, CGRectGetMaxY(self.collectionView.frame), Screen_Width, posHeight); } else{ vPosition.frame = CGRectMake(0, CGRectGetMaxY(self.vCustomTableView.frame), Screen_Width, posHeight); } [contentView addSubview:vPosition]; UIImageView *positionView = [UIImageView new]; positionView.frame = CGRectMake(20, 12,13, 15); positionView.image = [UIImage imageNamed:@"icon_position"]; [vPosition addSubview:positionView]; UILabel *lblPositionValue = [UILabel new]; lblPositionValue.frame = CGRectMake(CGRectGetMaxX(positionView.frame) + 3,8, ((Screen_Width - 45)), 25); lblPositionValue.font = kTextFont; lblPositionValue.text = posvalue; [vPosition addSubview:lblPositionValue]; } /** 初始化UI @param arr <#arr description#> */ - (void)initUI:(NSArray* )arr{ if(arr == nil){ return; } NSDictionary * dic = arr[0]; scroll = [UIScrollView new]; scroll.frame = self.view.bounds; scroll.tag = 1000; [self.view addSubview:scroll]; if(Screen_Height2 <= 480){ scroll.contentSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height + 80); } vCustomTableView = [UITableView new]; vCustomTableView.frame = CGRectZero; self.vCustomTableView.estimatedRowHeight = 44.0f; self.vCustomTableView.rowHeight = UITableViewAutomaticDimension; vCustomTableView.backgroundColor = [UIColor clearColor]; vCustomTableView.separatorStyle = UITableViewCellSeparatorStyleNone; vCustomTableView.delegate = self; vCustomTableView.scrollEnabled = NO; vCustomTableView.dataSource = self; contentView = [[UIView alloc]init]; contentView.frame=CGRectZero; contentView.backgroundColor = [UIColor clearColor]; [contentView addSubview:vCustomTableView]; _headerView = [[UIView alloc]init]; _headerView.frame = CGRectZero; _headerView.layer.cornerRadius =CornerRadius; _headerView.backgroundColor = [UIColor whiteColor]; [scroll addSubview:contentView]; double wh=((Screen_Width - 120 - 12)); //回执单号 ————————— UIView *vCode = [UIView new]; vCode.frame = CGRectMake(0, 1, Screen_Width, 51); [_headerView addSubview:vCode]; UILabel *lblcode = [UILabel new]; lblcode.frame = CGRectMake(10, 16,80, 25); lblcode.text = @"回执单号:"; lblcode.font = kTextFont; [vCode addSubview:lblcode]; UILabel *lblCodeValue = [UILabel new]; lblCodeValue.frame = CGRectMake(80, 16, wh, 25); lblCodeValue.text = [dic objectForKey:@"ReceiptNo"]; lblCodeValue.font = kTextFont; [vCode addSubview:lblCodeValue]; UIImageView *separatorImg = [[UIImageView alloc]initWithFrame:CGRectMake(0,CGRectGetMaxY(vCode.frame) - 1,Screen_Width, 1)]; [separatorImg setImage:[UIImage imageNamed:@"titlebotton"]]; [vCode addSubview:separatorImg]; [_headerView addSubview:vCode]; //安排单号 ————————— UIView *vArrangeCode = [UIView new]; vArrangeCode.frame = CGRectMake(0, CGRectGetMaxY(vCode.frame), Screen_Width, 31); [_headerView addSubview:vArrangeCode]; UILabel *lblArrangeCode = [UILabel new]; lblArrangeCode.frame = CGRectMake(10, 3,80, 25); lblArrangeCode.text = @"安排单号:"; lblArrangeCode.font = kTextFont; [vArrangeCode addSubview:lblArrangeCode]; UILabel *lblArrangeCodeValue = [UILabel new]; lblArrangeCodeValue.frame=CGRectMake(80, 3, wh, 25); lblArrangeCodeValue.text = [dic objectForKey:@"ArrangementNo"]; lblArrangeCodeValue.font = kTextFont; [vArrangeCode addSubview:lblArrangeCodeValue]; [_headerView addSubview:vArrangeCode]; [_headerView addSubview:vArrangeCode]; //单号 ————————— UIView *vInstallCode = [UIView new]; vInstallCode.frame = CGRectMake(0,CGRectGetMaxY(vArrangeCode.frame), Screen_Width, 31); [_headerView addSubview:vInstallCode]; UILabel *lblInstallCode = [UILabel new]; lblInstallCode.frame = CGRectMake(10, 3,80, 25); lblInstallCode.text = @"安装单号:"; lblInstallCode.font = kTextFont; [vInstallCode addSubview:lblInstallCode]; UILabel *lblInstallCodeValue = [UILabel new]; lblInstallCodeValue.frame = CGRectMake(80, 3, wh, 25); lblInstallCodeValue.text = [dic objectForKey:@"InstallationNo"]; lblInstallCodeValue.font = kTextFont; [vInstallCode addSubview:lblInstallCodeValue]; [_headerView addSubview:vInstallCode]; //回执类型 ————————— UIView *vReceiptType = [UIView new]; vReceiptType.frame = CGRectMake(0,CGRectGetMaxY(vInstallCode.frame), Screen_Width, 31); [_headerView addSubview:vReceiptType]; UILabel *lblReceiptType = [UILabel new]; lblReceiptType.frame = CGRectMake(10, 3,80, 25); lblReceiptType.text = @"回执类型:"; lblReceiptType.font = kTextFont; [vReceiptType addSubview:lblReceiptType]; UILabel *lblReceiptTypeValue = [UILabel new]; lblReceiptTypeValue.frame = CGRectMake(80, 3, wh, 25); lblReceiptTypeValue.font = kTextFont; NSString* value = [[dic objectForKey:@"recReceiptType"] stringValue]; if ([value isEqualToString:@"false"] || [value isEqualToString:@"0"]) { lblReceiptTypeValue.text = @"回执"; } if ([value isEqualToString:@"true"] || [value isEqualToString:@"1"]) { lblReceiptTypeValue.text = @"撤销回执"; } [vReceiptType addSubview:lblReceiptTypeValue]; [_headerView addSubview:vReceiptType]; //客户名称 ————————— UIView *vCustomerName = [UIView new]; vCustomerName.frame = CGRectMake(0,CGRectGetMaxY(vReceiptType.frame), Screen_Width, 31); [_headerView addSubview:vCustomerName]; UILabel *lblCustomerName = [UILabel new]; lblCustomerName.font = kTextFont; lblCustomerName.frame = CGRectMake(10, 3,80, 25); lblCustomerName.text = @"客户名称:"; [vCustomerName addSubview:lblCustomerName]; UILabel *lblCustomerNameValue = [UILabel new]; lblCustomerNameValue.font = kTextFont; lblCustomerNameValue.frame = CGRectMake(80, 3, wh, 25); lblCustomerNameValue.text = [dic objectForKey:@"CustomerName"]; [vCustomerName addSubview:lblCustomerNameValue]; [_headerView addSubview:vCustomerName]; //回执日期 ————————— UIView *vReceiptDate = [UIView new]; vReceiptDate.frame = CGRectMake(0,CGRectGetMaxY(vCustomerName.frame), Screen_Width, 31); [_headerView addSubview:vReceiptDate]; UILabel *lblReceiptDate = [UILabel new]; lblReceiptDate.font = kTextFont; lblReceiptDate.frame = CGRectMake(10, 3,80, 25); lblReceiptDate.text = @"回执日期:"; [vReceiptDate addSubview:lblReceiptDate]; UILabel *lblReceiptDateValue = [UILabel new]; lblReceiptDateValue.font = kTextFont; lblReceiptDateValue.frame = CGRectMake(80, 3, wh, 25); if ([dic objectForKey:@"ReceiptTime"] != nil) { lblReceiptDateValue.text = [DateFormat dateFormatSplit:[dic objectForKey:@"ReceiptTime"]] ; }else{ lblReceiptDateValue.text = @""; } [vReceiptDate addSubview:lblReceiptDateValue]; //安装地址 ————————— UIView *vInstallAddress = [UIView new]; vInstallAddress.frame = CGRectMake(0,CGRectGetMaxY(vReceiptDate.frame), Screen_Width, 31); [_headerView addSubview:vInstallAddress]; UILabel *lblInstallAddress = [UILabel new]; lblInstallAddress.frame = CGRectMake(10, 3,80, 25); lblInstallAddress.text = @"安装地址:"; lblInstallAddress.font = kTextFont; [vInstallAddress addSubview:lblInstallAddress]; UILabel *lblInstallAddressValue = [UILabel new]; lblInstallAddressValue.frame = CGRectMake(80, 3, wh, 25); lblInstallAddressValue.font = kTextFont; lblInstallAddressValue.text = [dic objectForKey:@"Address"]; [vInstallAddress addSubview:lblInstallAddressValue]; //应收金额 ————————— UIView *vReceivables = [UIView new]; vReceivables.frame = CGRectMake(0,CGRectGetMaxY(vInstallAddress.frame), Screen_Width, 31); [_headerView addSubview:vReceivables]; UILabel *lblReceivables = [UILabel new]; lblReceivables.font = kTextFont; lblReceivables.frame = CGRectMake(10, 3,80, 25); lblReceivables.text = @"应收金额:"; [vReceivables addSubview:lblReceivables]; UILabel *lblReceivablesValue = [UILabel new]; lblReceivablesValue.font = kTextFont; lblReceivablesValue.frame = CGRectMake(80, 3, wh, 25); lblReceivablesValue.text = [NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"Receivables"] doubleValue]]; [vReceivables addSubview:lblReceivablesValue]; //已回金额 ————————— UIView *vCompleteReceivables = [UIView new]; vCompleteReceivables.frame = CGRectMake(0,CGRectGetMaxY(vReceivables.frame), Screen_Width, 31); [_headerView addSubview:vCompleteReceivables]; UILabel *lblCompleteReceivables = [UILabel new]; lblCompleteReceivables.frame = CGRectMake(10, 3,80, 25); lblCompleteReceivables.text = @"已回执金额:"; lblCompleteReceivables.font = kTextFont; [vCompleteReceivables addSubview:lblCompleteReceivables]; UILabel *lblCompleteReceivablesValue = [UILabel new]; lblCompleteReceivablesValue.frame = CGRectMake(92, 3, wh, 25); lblCompleteReceivablesValue.font = kTextFont; lblCompleteReceivablesValue.text = [NSString stringWithFormat:@"%.2f",[[dic objectForKey:@"CompleteReceivables"] doubleValue]]; [vCompleteReceivables addSubview:lblCompleteReceivablesValue]; //回执标识 ————————— UIView *vReceiptFlag = [UIView new]; vReceiptFlag.frame = CGRectMake(0,CGRectGetMaxY(vCompleteReceivables.frame), Screen_Width, 31); [_headerView addSubview:vReceiptFlag]; UILabel *lblReceiptFlag = [UILabel new]; lblReceiptFlag.frame = CGRectMake(10, 3,80, 25); lblReceiptFlag.text = @"回执标识:"; lblReceiptFlag.font = kTextFont; [vReceiptFlag addSubview:lblReceiptFlag]; UILabel *lblReceiptFlagValue = [UILabel new]; lblReceiptFlagValue.font = kTextFont; lblReceiptFlagValue.frame = CGRectMake(80, 3, wh, 25); BOOL flag = [[dic objectForKey:@"ReceiptFlag"] boolValue]; if (flag) { lblReceiptFlagValue.text = @"是"; }else{ lblReceiptFlagValue.text = @"否"; } [vReceiptFlag addSubview:lblReceiptFlagValue]; //单据回执类型 ————————— UIView *vDocReceiptType = [UIView new]; vDocReceiptType.frame = CGRectMake(0,CGRectGetMaxY(vReceiptFlag.frame), Screen_Width, 31); [_headerView addSubview:vDocReceiptType]; UILabel *lblDocReceiptType = [UILabel new]; lblDocReceiptType.font = kTextFont; lblDocReceiptType.frame = CGRectMake(10, 3, 80, 25); lblDocReceiptType.text = @"回执状态:"; [vDocReceiptType addSubview:lblDocReceiptType]; UILabel *lblDocReceiptTypeValue = [UILabel new]; lblDocReceiptTypeValue.font = kTextFont; lblDocReceiptTypeValue.frame = CGRectMake(80, 3, wh-20, 25); value = [[dic objectForKey:@"ReceiptType"] stringValue]; if ([value isEqualToString:@"1"]) { lblDocReceiptTypeValue.text = @"完成"; } if ([value isEqualToString:@"3"]) { lblDocReceiptTypeValue.text = @"推迟安装"; } [vDocReceiptType addSubview:lblDocReceiptTypeValue]; //推迟日期 UIView *vNextDate = [UIView new]; vNextDate.frame=CGRectMake(0,CGRectGetMaxY(vDocReceiptType.frame), Screen_Width, 31); [_headerView addSubview:vNextDate]; UILabel *lblNextDate = [UILabel new]; lblNextDate.frame = CGRectMake(10, 3,80, 25); lblNextDate.text = @"推迟日期:"; lblNextDate.font = kTextFont; [vNextDate addSubview:lblNextDate]; UILabel *lblNextDateValue = [UILabel new]; lblNextDateValue.frame = CGRectMake(80, 3, wh, 25); if ([value isEqualToString:@"3"]) { NSString *nextInstallationDate= [dic objectForKey:@"NextInstallDate"]; if(nextInstallationDate!=nil){ lblNextDateValue.text = [DateFormat dateFormatSplit:nextInstallationDate]; } } lblNextDateValue.font = kTextFont; [vNextDate addSubview:lblNextDateValue]; _headerView.frame = CGRectMake(0,0,vCustomTableView.bounds.size.width,CGRectGetMaxY(vNextDate.frame)); vCustomTableView.tableHeaderView = _headerView; [self setupCollectionView]; } /** 获取tableview的高度 @param Array <#Array description#> @return <#return value description#> */ - (CGFloat)getArrayViewHeight:(NSArray *)Array { // 上下间隔已经在frame上做了 NSInteger row = Array.count; CGFloat allheight = 0; for (int i = 0; i < Array.count; i++) { InstallReceiptDetailModel *info = Array[i]; if(info.receiptRemark == nil){ //不加空格计算不出备注的高度 info.receiptRemark = @" "; } CGFloat height = [info.receiptRemark sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:CGSizeMake(SCREENWIDTH-110, MAXFLOAT)].height + 660; allheight += height; } return allheight; } /** 数据加载接口 */ - (void)initData{ [self startLoading]; NSString *urlStr = ServerURL; NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict setObject:@"GetInstallationReceiptDetailIphone" forKey:@"Action"]; [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"]; [dict setObject:kkUserCode forKey:@"UserCode"]; [dict setObject:kkUserPwd forKey:@"UserPassword"]; [dict setObject:kkSessionKey forKey:@"SessionKey"]; [dict setObject:_installationId forKey:@"InstallationID"]; [dict setObject:_arrangementId forKey:@"ArrangementID"]; [dict setObject:_receiptNo forKey:@"RecReceiptNo"]; self.mDownManager = [[ASIDownManager alloc] init]; NSString *JsonArr = [self.mDownManager syncPostHttpRequestUrl:urlStr dic:dict path:nil filename:nil fileType:nil]; RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:JsonArr]; int iStatus = resultModel.status; NSString *message = resultModel.message; if (iStatus == 0) { NSArray *infoArr; NSArray *infoHead; NSArray *posArr; [_dataList removeAllObjects]; [_dataHead removeAllObjects]; NSDictionary *dicResult =(NSDictionary*) resultModel.result; if(dicResult != nil){ infoArr = [dicResult objectForKey:@"Table1"]; infoHead = [dicResult objectForKey:@"Table"]; imageArr = [dicResult objectForKey:@"ImagePath"]; posArr = [dicResult objectForKey:@"Position"]; } [self cancel]; //更新ui if(infoHead!= nil && infoHead.count > 0){ [self initUI:infoHead]; } if(infoArr != nil&&infoArr.count > 0){ for(int i=0;i 0) { [self.assets removeAllObjects]; //共条数据 for (int i = 0; i < imageArr.count; i++) { NSDictionary *dicImages=imageArr[i]; NSString * imgPath = [dicImages objectForKey:@"ImagePath"]; if(imgPath != nil && [imgPath length] > 0){ NSString *imageUrl = [NSString stringWithFormat:@"http://%@:%@/WebService/%@",kkServerUrl,kkServerPort,imgPath]; DKCamera *c = [[DKCamera alloc] init]; NSString *imagePath = (NSString *)[self.mDownManager downloadImageWithURL:imageUrl]; if (imagePath == nil || [imagePath isEqualToString:@""]) { continue; } c.imagePath = imagePath; c.thumbImage = [UIImage imageWithContentsOfFile:imagePath ]; [self.assets addObject:c]; } } _collectionView.frame = CGRectMake(0,CGRectGetMaxY(vCustomTableView.frame), Screen_Width, [Util getPhotoCollectionViewHeightWithPhotos:self.assets]); contentView.frame = CGRectMake(0,0,self.view.bounds.size.width,CGRectGetMaxY(self.collectionView.frame)); scroll.contentSize = CGSizeMake(self.view.frame.size.width, contentView.frame.size.height + 90); [self.collectionView reloadData]; } if(posArr != nil && posArr.count > 0) { //共一条数据 NSDictionary * dicPositon = posArr[0]; NSString *pos = [dicPositon objectForKey:@"Position"]; [self initPositionUI:pos]; contentView.frame=CGRectMake(0,0,self.view.bounds.size.width,CGRectGetMaxY(vPosition.frame)); scroll.contentSize=CGSizeMake(self.view.frame.size.width, contentView.frame.size.height + 90); } } else if(iStatus == ActionResultStatusAuthError || iStatus == ActionResultStatusNoLogin || iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){ [self showReLoginDialog:message]; return; } else{ [self showAlertViewText:message]; return; } } /** 进度条取消函数 */ - (void)cancel { [self stopLoading]; } @end