diff --git a/redstar.xcodeproj/project.pbxproj b/redstar.xcodeproj/project.pbxproj index ed4e9bdd24f27aefa654c3275d04ace317a739df..1fa17158b1c6c166cfd07cff1b0c4335f1ae9fd6 100644 --- a/redstar.xcodeproj/project.pbxproj +++ b/redstar.xcodeproj/project.pbxproj @@ -72,6 +72,7 @@ 84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D825811BDD35E000CC61F7 /* HomeHeaderView.m */; }; 84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */; }; 84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */; }; + 84E363D21BFAC5200061547E /* TaskListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E363D11BFAC5200061547E /* TaskListModel.m */; }; 84E420411BE849FC00689976 /* QuestionDescribeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420401BE849FC00689976 /* QuestionDescribeCell.m */; }; 84E420441BE84A2300689976 /* QuestionCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420431BE84A2300689976 /* QuestionCommentCell.m */; }; 84E420471BE88AE000689976 /* RootTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E420461BE88AE000689976 /* RootTabBarController.m */; }; @@ -237,6 +238,8 @@ 84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomDropMenuView.m; sourceTree = "<group>"; }; 84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; }; 84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Extension.m"; sourceTree = "<group>"; }; + 84E363D01BFAC5200061547E /* TaskListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TaskListModel.h; sourceTree = "<group>"; }; + 84E363D11BFAC5200061547E /* TaskListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TaskListModel.m; sourceTree = "<group>"; }; 84E4203F1BE849FC00689976 /* QuestionDescribeCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionDescribeCell.h; sourceTree = "<group>"; }; 84E420401BE849FC00689976 /* QuestionDescribeCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuestionDescribeCell.m; sourceTree = "<group>"; }; 84E420421BE84A2300689976 /* QuestionCommentCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionCommentCell.h; sourceTree = "<group>"; }; @@ -602,6 +605,7 @@ 8486999C1BDF810900859DFE /* InspectList */ = { isa = PBXGroup; children = ( + 84E363CC1BFAC3600061547E /* Model */, 8486999D1BDF810900859DFE /* Cell */, 848699A21BDF810900859DFE /* ViewController */, ); @@ -1117,6 +1121,15 @@ path = CustomDropMenu; sourceTree = "<group>"; }; + 84E363CC1BFAC3600061547E /* Model */ = { + isa = PBXGroup; + children = ( + 84E363D01BFAC5200061547E /* TaskListModel.h */, + 84E363D11BFAC5200061547E /* TaskListModel.m */, + ); + path = Model; + sourceTree = "<group>"; + }; 84F166981BE715D20061D350 /* ZanButton */ = { isa = PBXGroup; children = ( @@ -1456,6 +1469,7 @@ 848699B21BDF810900859DFE /* InspectListViewController.m in Sources */, 84846E971BE069BC0010550A /* DateButton.m in Sources */, 84AD4F201BF425AC00BFB37C /* InspectDetailView.m in Sources */, + 84E363D21BFAC5200061547E /* TaskListModel.m in Sources */, 84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */, 848699B01BDF810900859DFE /* InspectListCell.m in Sources */, 84AD4F3A1BF4844600BFB37C /* RankDetailHeaderView.m in Sources */, diff --git a/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate b/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate index e0e75de72943b7cb1f99434f287ea9064964f0ee..c8ff5075a0c10e6c9b4ca9b2d6230c141f5d0306 100644 Binary files a/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate and b/redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectSettleViewController.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectSettleViewController.m index 032c643b879d9bafe3d5a8b8d20309c1df8d4de2..46b4303b3191dc7f694899c640973e391c37e22c 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectSettleViewController.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectDetail/ViewController/InspectSettleViewController.m @@ -39,8 +39,6 @@ self.footerView.takePhotoView.delegate = self; [self.footerView.takePhotoView.btn addTarget:self action:@selector(addNew:) forControlEvents:UIControlEventTouchUpInside]; - // å£ç¢‘巡检明细 - [self requestRankingDetail]; } - (void)didReceiveMemoryWarning { @@ -49,18 +47,7 @@ } #pragma mark - private Methods -- (void) requestRankingDetail -{ - NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL,@"5a74170150dba4ed0150dbad2e4d0001", @"2c9183fe50db19f90150db211d650081"]; - - HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; - [httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) { - NSLog(@"å£ç¢‘巡检明细PraiseDetail = %@", response); - }]; - -// NSDictionary *paramr = @{@"uuid":@"5a74170150dba4ed0150dbad2e4d0001", -// @"storeUuid":@"2c9183fe50db19f90150db211d650081"}; -} + #pragma mark - TakePhoto Delegate diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.h b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.h index 45b638540a7cc6b1a3d5f77fb6cae35d9eccd4f7..1d17e40f8f199bfd01b22539a1e4690eb57a1456 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.h +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.h @@ -7,6 +7,8 @@ // #import <UIKit/UIKit.h> +@class TaskListModel; + typedef enum ProgressState : NSUInteger { ProgressStateUnSettled = 0,// æœªå¤„ç† ProgressStateDealWith, // 处ç†ä¸ @@ -26,4 +28,6 @@ typedef enum ProgressState : NSUInteger { @property (nonatomic, strong) UIView *alreadyView; @property (nonatomic, strong) UIView *allView; + +@property (nonatomic, strong) TaskListModel *taskList; @end diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.m index 056d390f56b3536574d933dd50cd5e416a6c8d0f..73680cf354226b839549cb6a0213117c3eadb08b 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Cell/InspectListCell.m @@ -7,6 +7,7 @@ // #import "InspectListCell.h" +#import "TaskListModel.h" @interface InspectListCell () @property (nonatomic, strong) UILabel *progressLabel; @@ -38,10 +39,22 @@ } -- (void)setProgressState:(ProgressState)progressState +- (void)setTaskList:(TaskListModel *)taskList { - _progressState = progressState; - if (_progressState == ProgressStateUnSettled) { + _taskList = taskList; + self.titleLabel.text = [NSString stringWithFormat:@"%@", taskList.name]; + self.startDate.text = [NSString stringWithFormat:@"起始时间:%@", taskList.beginDate]; + self.overDate.text = [NSString stringWithFormat:@"æˆªæ¢æ—¶é—´ï¼š%@", taskList.endDate]; + self.alreadyLabel.text = [NSString stringWithFormat:@"%@", taskList.reportCount]; + self.allLabel.text = [NSString stringWithFormat:@"/%@", taskList.questionCount]; + + CGFloat already = [taskList.reportCount floatValue]; + CGFloat all = [taskList.questionCount floatValue]; + self.multiplier = already / all; + self.allView.backgroundColor = kProgressViewAllBackColor; + self.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; + + if ([taskList.state isEqualToString:@"initial"]) { NSString *str = [NSString stringWithFormat:@"巡检进度:未处ç†"]; NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; @@ -49,8 +62,7 @@ [self.progressLabel setAttributedText:strAttr]; self.alreadyLabel.textColor = kProgressUnSettledColor; self.allLabel.textColor = kProgressUnSettledColor; - - } else if (_progressState == ProgressStateDealWith) { + } else if ([taskList.state isEqualToString:@"processing"]) { NSString *str = [NSString stringWithFormat:@"巡检进度:进行ä¸"]; NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; @@ -58,7 +70,30 @@ [self.progressLabel setAttributedText:strAttr]; self.alreadyLabel.textColor = kProgressDealWithColor; self.allLabel.textColor = kProgressDealWithColor; - + } else if ([taskList.state isEqualToString:@"reported"]) { + NSString *str = [NSString stringWithFormat:@"巡检进度:已上报"]; + NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)]; + [self.progressLabel setAttributedText:strAttr]; + self.alreadyLabel.textColor = kProgressDealWithColor; + self.allLabel.textColor = kProgressDealWithColor; + } else if ([taskList.state isEqualToString:@"finished"]) { + NSString *str = [NSString stringWithFormat:@"巡检进度:已评分"]; + NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kProgressDealWithColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)]; + [self.progressLabel setAttributedText:strAttr]; + self.alreadyLabel.textColor = kProgressDealWithColor; + self.allLabel.textColor = kProgressDealWithColor; + } else if ([taskList.state isEqualToString:@"published"]) { + NSString *str = [NSString stringWithFormat:@"巡检进度:已å‘布"]; + NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kCellDetailColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,5)]; + [strAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)]; + [self.progressLabel setAttributedText:strAttr]; + self.alreadyLabel.textColor = kProgressDealWithColor; + self.allLabel.textColor = kProgressDealWithColor; } else { NSString *str = [NSString stringWithFormat:@"巡检进度:已过期"]; NSMutableAttributedString *strAttr = [[NSMutableAttributedString alloc] initWithString:str]; @@ -67,6 +102,20 @@ [self.progressLabel setAttributedText:strAttr]; self.alreadyLabel.textColor = kProgressOverDueColor; self.allLabel.textColor = kProgressOverDueColor; + } +} + +- (void)setProgressState:(ProgressState)progressState +{ + _progressState = progressState; + if (_progressState == ProgressStateUnSettled) { + + + } else if (_progressState == ProgressStateDealWith) { + + + } else { + } } @@ -257,7 +306,7 @@ NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1]; [self.allView addConstraint:overDateBottom]; - NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:_multiplier constant:-1]; + NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:_multiplier constant:0]; [self.allView addConstraint:overDatewidth]; } diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.h b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.h new file mode 100644 index 0000000000000000000000000000000000000000..b65987d57addea5ef611fdc2a6f55e9fec076704 --- /dev/null +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.h @@ -0,0 +1,38 @@ +// +// TaskListModel.h +// redstar +// +// Created by admin on 15/11/17. +// Copyright © 2015å¹´ ZWF. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface TaskListModel : NSObject +@property (nonatomic, copy) NSString *beginDate; +@property (nonatomic, copy) NSArray *categories; +@property (nonatomic, copy) NSString *commentId; +@property (nonatomic, copy) NSString *create_id; +@property (nonatomic, copy) NSString *create_operName; +@property (nonatomic, copy) NSString *create_time; +@property (nonatomic, copy) NSString *endDate; +@property (nonatomic, copy) NSString *enterprise; +@property (nonatomic, copy) NSString *lastModify_id; +@property (nonatomic, copy) NSString *lastModify_operName; +@property (nonatomic, copy) NSString *lastModify_time; +@property (nonatomic, copy) NSString *name; +@property (nonatomic, copy) NSString *questionCount; +@property (nonatomic, copy) NSArray *questions; +@property (nonatomic, copy) NSString *ranking; +@property (nonatomic, copy) NSString *reportCount; +@property (nonatomic, copy) NSString *reportTime; +@property (nonatomic, copy) NSString *reported; +@property (nonatomic, copy) NSString *score; +@property (nonatomic, copy) NSString *state; +@property (nonatomic, copy) NSString *store_code; +@property (nonatomic, copy) NSString *store_name; +@property (nonatomic, copy) NSString *store_uuid; +@property (nonatomic, copy) NSArray *stores; +@property (nonatomic, copy) NSString *uuid; +@property (nonatomic, copy) NSString *version; +@end diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.m new file mode 100644 index 0000000000000000000000000000000000000000..e93e16034583d67bc6903bcf022fa70103921122 --- /dev/null +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/Model/TaskListModel.m @@ -0,0 +1,13 @@ +// +// TaskListModel.m +// redstar +// +// Created by admin on 15/11/17. +// Copyright © 2015å¹´ ZWF. All rights reserved. +// + +#import "TaskListModel.h" + +@implementation TaskListModel + +@end diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/ViewController/InspectListViewController.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/ViewController/InspectListViewController.m index f3727ef4fc166235a66894a0a41860f899dec880..54865ae28cf06c16120c622638b7878ba60d71c6 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/ViewController/InspectListViewController.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectList/ViewController/InspectListViewController.m @@ -18,25 +18,22 @@ #import "TaxisView.h" #import "ScreenView.h" +#import "TaskListModel.h" + #define kInspectListCell @"InspectListCellTableViewCell" @interface InspectListViewController ()<UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate> @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) MenuView *menuView; -@property (nonatomic, strong) NSArray *test1Array; -@property (nonatomic, strong) NSArray *test2Array; -@property (nonatomic, strong) NSArray *test3Array; -@property (nonatomic, strong) NSArray *test4Array; -@property (nonatomic, strong) NSArray *test5Array; -@property (nonatomic, strong) NSArray *test6Array; - @property (nonatomic, strong) TaxisView *taxisView; @property (nonatomic, strong) ScreenView *screenView; @property (nonatomic, strong) UIView *bgView; @property (nonatomic, strong) MenuButton *selctedButton; +@property (nonatomic, strong) NSMutableArray *taskListDataArray; + @end @implementation InspectListViewController @@ -66,15 +63,9 @@ self.navigationController.navigationBar.translucent = NO; } - [self.tableView registerClass:[InspectListCell class] forCellReuseIdentifier:kInspectListCell]; - // - self.test1Array = [NSArray arrayWithObjects:@"2015å¹´9月å£ç¢‘巡检",@"2015å¹´9月å«ç”Ÿä¸“项巡检",@"2015å¹´9月真北店安全临时巡检",@"2015å¹´10月å«ç”Ÿä¸“项巡检",@"2015å¹´10月设备安全巡检", nil]; - self.test2Array = [NSArray arrayWithObjects:@"2015-09-01 10:28:52",@"2015-09-08 12:47:32",@"2015-10-21 07:58:22",@"2015-10-09 19:08:52",@"2015-09-01 14:19:52", nil]; - self.test3Array = [NSArray arrayWithObjects:@"2015-09-03",@"2015-09-15",@"2015-10-22",@"2015-11-02",@"2015-11-05", nil]; - self.test4Array = [NSArray arrayWithObjects:@"2",@"3",@"1",@"2",@"1", nil]; - self.test5Array = [NSArray arrayWithObjects:@(5),@(12),@(0),@(8),@(20), nil]; - self.test6Array = [NSArray arrayWithObjects:@(16),@(25),@(20),@(100),@(20), nil]; + // åˆå§‹åŒ–数组 + self.taskListDataArray = [NSMutableArray array]; [self requestInspectList]; @@ -127,7 +118,18 @@ @"pageSize":@(10) }; [httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) { - NSLog(@"巡检列表respone = %@", response); + + NSLog(@"巡检列表%@", response); + + NSDictionary *dataDict = response[@"data"]; + NSArray *dataArray = dataDict[@"records"]; + for (NSDictionary *dict in dataArray) { + TaskListModel *taskList = [[TaskListModel alloc] init]; + [taskList setValuesForKeysWithDictionary:dict]; + [_taskListDataArray addObject:taskList]; + } + self.tableView.delegate = self; + self.tableView.dataSource = self; }]; } @@ -291,7 +293,7 @@ #pragma mark - UITableView Delegate/DataSource - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 5; + return self.taskListDataArray.count; } // cell显示的内容 @@ -301,36 +303,30 @@ if (!cell) { cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectListCell]; } + cell.taskList = (TaskListModel *)_taskListDataArray[indexPath.row]; cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.titleLabel.text = [NSString stringWithFormat:@"%@", _test1Array[indexPath.row]]; - cell.startDate.text = [NSString stringWithFormat:@"起始时间:%@", _test2Array[indexPath.row]]; - cell.overDate.text = [NSString stringWithFormat:@"æˆªæ¢æ—¶é—´ï¼š%@", _test3Array[indexPath.row]]; - if ([_test4Array[indexPath.row] isEqualToString:@"1"]) { - cell.progressState = ProgressStateUnSettled; - } else if ([_test4Array[indexPath.row] isEqualToString:@"2"]) { - cell.progressState = ProgressStateDealWith; - } else { - cell.progressState = ProgressStateOverDue; - } - cell.alreadyLabel.text = [NSString stringWithFormat:@"%@", _test5Array[indexPath.row]]; - cell.allLabel.text = [NSString stringWithFormat:@"/%@", _test6Array[indexPath.row]]; - CGFloat already = [_test5Array[indexPath.row] floatValue]; - CGFloat all = [_test6Array[indexPath.row] floatValue]; - cell.multiplier = already / all; - cell.allView.backgroundColor = kProgressViewAllBackColor; - cell.alreadyView.backgroundColor = kProgressViewAlreadyBackColor; + return cell; } // cell的点击事件 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - InspectListCell *cell = (InspectListCell *)[self tableView:_tableView cellForRowAtIndexPath:indexPath]; + TaskListModel *taskList = _taskListDataArray[indexPath.row]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; - inspectTaskVC.multiplier = cell.multiplier; - inspectTaskVC.alreadyNumber = cell.alreadyLabel.text; - inspectTaskVC.allNumber = cell.allLabel.text; - inspectTaskVC.progressState = cell.progressState; + inspectTaskVC.uuid = taskList.uuid; + inspectTaskVC.store_uuid = taskList.store_uuid; + CGFloat already = [taskList.reportCount floatValue]; + CGFloat all = [taskList.questionCount floatValue]; + inspectTaskVC.multiplier = already / all; + NSLog(@"store_uuid = %@, uuid = %@",inspectTaskVC.store_uuid,inspectTaskVC.uuid); +// InspectListCell *cell = (InspectListCell *)[self tableView:_tableView cellForRowAtIndexPath:indexPath]; +// +// +// inspectTaskVC.multiplier = cell.multiplier; +// inspectTaskVC.alreadyNumber = cell.alreadyLabel.text; +// inspectTaskVC.allNumber = cell.allLabel.text; +// inspectTaskVC.progressState = cell.progressState; [self.navigationController pushViewController:inspectTaskVC animated:YES]; } @@ -351,76 +347,6 @@ return 0; } -//// 自定义section -//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section -//{ -// // 创建sectionView -// UIView *sectionView = [[UIView alloc] init]; -// sectionView.userInteractionEnabled = YES; -// sectionView.backgroundColor = kInspectSectionBackGroundColor; -// -// UIView *lineView = [[UIView alloc] init]; -// lineView.translatesAutoresizingMaskIntoConstraints = NO; -// lineView.backgroundColor = kSeparateLineColor; -// [sectionView addSubview:lineView]; -// -// NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; -// [sectionView addConstraint:lineTop]; -// -// NSLayoutConstraint *lineLeft = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-0.5]; -// [sectionView addConstraint:lineLeft]; -// -// NSLayoutConstraint *lineWidth = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1]; -// [sectionView addConstraint:lineWidth]; -// -// NSLayoutConstraint *lineBottom = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; -// [sectionView addConstraint:lineBottom]; -// -// MenuButton *taxiButton = [[MenuButton alloc] init]; -// taxiButton.translatesAutoresizingMaskIntoConstraints = NO; -// [taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal]; -// [taxiButton setImage:[UIImage imageNamed:@"sort_icon"] forState:UIControlStateNormal]; -// taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0]; -// [taxiButton setTitle:@"排åº" forState:UIControlStateNormal]; -// [taxiButton addTarget:self action:@selector(taxisBtnCilck:) forControlEvents:UIControlEventTouchUpInside]; -// [sectionView addSubview:taxiButton]; -// -// MenuButton *screenButton = [[MenuButton alloc] init]; -// screenButton.translatesAutoresizingMaskIntoConstraints = NO; -// [screenButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal]; -// [screenButton setImage:[UIImage imageNamed:@"filter_icon"] forState:UIControlStateNormal]; -// screenButton.titleLabel.font = [UIFont systemFontOfSize:14.0]; -// [screenButton setTitle:@"ç›é€‰" forState:UIControlStateNormal]; -// [sectionView addSubview:screenButton]; -// -// // taxiButton布局 -// NSLayoutConstraint *taxiButtonTop = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; -// [sectionView addConstraint:taxiButtonTop]; -// -// NSLayoutConstraint *taxiButtonLeft = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; -// [sectionView addConstraint:taxiButtonLeft]; -// -// NSLayoutConstraint *taxiButtonWidth = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:screenButton attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0]; -// [sectionView addConstraint:taxiButtonWidth]; -// -// NSLayoutConstraint *taxiButtonBottom = [NSLayoutConstraint constraintWithItem:taxiButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; -// [sectionView addConstraint:taxiButtonBottom]; -// -// // screenButton布局 -// NSLayoutConstraint *screenButtonTop = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; -// [sectionView addConstraint:screenButtonTop]; -// -// NSLayoutConstraint *screenButtonRight = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; -// [sectionView addConstraint:screenButtonRight]; -// -// NSLayoutConstraint *screenButtonLeft = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:taxiButton attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; -// [sectionView addConstraint:screenButtonLeft]; -// -// NSLayoutConstraint *screenButtonBottom = [NSLayoutConstraint constraintWithItem:screenButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; -// [sectionView addConstraint:screenButtonBottom]; -// -// return sectionView; -//} #pragma mark - lazy loading @@ -453,10 +379,11 @@ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.translatesAutoresizingMaskIntoConstraints = NO; - _tableView.delegate = self; - _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; _tableView.showsHorizontalScrollIndicator = NO; + _tableView.tableFooterView = [[UIView alloc] init]; + [_tableView registerClass:[InspectListCell class] forCellReuseIdentifier:kInspectListCell]; + [self.view addSubview:_tableView]; NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:45]; diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailHeaderView.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailHeaderView.m index bb0122982272f520717fc73ec9816cb605d64dfc..d319d2daaa49d6c017d11ea557d658450f0d6e39 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailHeaderView.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailHeaderView.m @@ -94,8 +94,6 @@ NSLayoutConstraint *classifyLeft = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20]; [self addConstraint:classifyLeft]; - NSLayoutConstraint *classifyWidth = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; - [self addConstraint:classifyWidth]; NSLayoutConstraint *classifyHeight = [NSLayoutConstraint constraintWithItem:classifyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:39]; [self addConstraint:classifyHeight]; diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailView.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailView.m index 2af207268f6ebd231bb20b72ef4e65cc52350b90..ea3293c602ac15a9041fb6fb7ea1b6a081d3d28e 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailView.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/View/InspectDetailView.m @@ -285,7 +285,7 @@ NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1]; [self.allView addConstraint:overDateBottom]; - NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:self.multiplier constant:-1]; + NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:_multiplier constant:0]; [self.allView addConstraint:overDatewidth]; } @@ -331,8 +331,8 @@ NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_shopnameLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.shopname attribute:NSLayoutAttributeRight multiplier:1.0 constant:15]; [self addConstraint:Left]; - NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_shopnameLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; - [self addConstraint:Right]; +// NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_shopnameLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; +// [self addConstraint:Right]; NSLayoutConstraint *Height = [NSLayoutConstraint constraintWithItem:_shopnameLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25]; [self addConstraint:Height]; @@ -421,17 +421,18 @@ _startDateLabel = [[UILabel alloc] init]; _startDateLabel.font = [UIFont systemFontOfSize:15.0]; _startDateLabel.textColor = kLightBlack; + _startDateLabel.textAlignment = NSTextAlignmentLeft; _startDateLabel.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:_startDateLabel]; NSLayoutConstraint *Top = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.shopnameLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5]; [self addConstraint:Top]; - NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.startDate attribute:NSLayoutAttributeRight multiplier:1.0 constant:15]; + NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:100]; [self addConstraint:Left]; - NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.surplus attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; - [self addConstraint:Right]; +// NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.surplus attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; +// [self addConstraint:Right]; NSLayoutConstraint *Height = [NSLayoutConstraint constraintWithItem:_startDateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25]; [self addConstraint:Height]; @@ -446,17 +447,17 @@ _overDateLabel = [[UILabel alloc] init]; _overDateLabel.font = [UIFont systemFontOfSize:15.0]; _overDateLabel.textColor = kLightBlack; + _overDateLabel.textAlignment = NSTextAlignmentLeft; _overDateLabel.translatesAutoresizingMaskIntoConstraints = NO; [self addSubview:_overDateLabel]; NSLayoutConstraint *Top = [NSLayoutConstraint constraintWithItem:_overDateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.startDateLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5]; [self addConstraint:Top]; - NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_overDateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeRight multiplier:1.0 constant:15]; + NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_overDateLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeLeft multiplier:1.0 constant:80]; [self addConstraint:Left]; - NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_overDateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; - [self addConstraint:Right]; + NSLayoutConstraint *Height = [NSLayoutConstraint constraintWithItem:_overDateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25]; [self addConstraint:Height]; @@ -475,7 +476,7 @@ NSLayoutConstraint *Top = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDateLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5]; [self addConstraint:Top]; - NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.progress attribute:NSLayoutAttributeRight multiplier:1.0 constant:15]; + NSLayoutConstraint *Left = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:100]; [self addConstraint:Left]; NSLayoutConstraint *Right = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.alreadyLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.h b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.h index 06b1f5ce147ab636e3f34ad33179c9f0b040ce96..212f4c0ef0993bf9c438a61866dc96035c2cd844 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.h +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.h @@ -12,6 +12,10 @@ @interface InspectTaskViewController : UIViewController @property (nonatomic, assign) ProgressState progressState; @property (nonatomic, assign) CGFloat multiplier; -@property (nonatomic, strong) NSString *allNumber; -@property (nonatomic, strong) NSString *alreadyNumber; +@property (nonatomic, copy) NSString *allNumber; +@property (nonatomic, copy) NSString *alreadyNumber; + +@property (nonatomic, copy) NSString *store_uuid; +@property (nonatomic, copy) NSString *uuid; + @end diff --git a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.m b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.m index fea94526e3f9c4347ca56faac81529df07ba514b..e99b22538b11992af4f9d4ae75d65fcf4246e9a7 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Inspect/InspectTask/ViewController/InspectTaskViewController.m @@ -16,6 +16,7 @@ #import "TaskGroup.h" #import "TaskModel.h" #import "InspectHeaderView.h" +#import "HttpClient.h" #define kTaskSortCell @"InspectTaskSortCell" @@ -55,12 +56,10 @@ customLab.font = [UIFont boldSystemFontOfSize:19]; self.navigationItem.titleView = customLab; - self.tableView.tableHeaderView = self.detailHeaderView; - - [self setupTableView]; - + // å£ç¢‘巡检明细 + [self requestRankingDetail]; } - (void)didReceiveMemoryWarning { @@ -70,9 +69,21 @@ #pragma mark - Private Methods +- (void)requestRankingDetail +{ + NSString *url = [NSString stringWithFormat:@"%@%@%@/%@",kRedStarURL, kInspectDetailURL, self.uuid, self.store_uuid]; + + HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url]; + [httpClient getPraiseDetailWithParameters:nil completion:^(id response, NSError *error) { + NSLog(@"å£ç¢‘巡检明细PraiseDetail = %@", response); + + self.tableView.delegate = self; + self.tableView.dataSource = self; + }]; +} + - (void)setupTableView { - [self.tableView registerClass:[InspectSortTableCell class] forCellReuseIdentifier:kTaskSortCell]; NSURL *url = [[NSBundle mainBundle] URLForResource:@"classfiy.plist" withExtension:nil]; NSArray *tempArray = [NSArray arrayWithContentsOfURL:url]; @@ -153,7 +164,7 @@ - (void)clickHeadView { - [self.tableView reloadData]; + [_tableView reloadData]; } #pragma mark - lazy loading - (UITableView *)tableView @@ -161,10 +172,10 @@ if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; _tableView.translatesAutoresizingMaskIntoConstraints = NO; - _tableView.delegate = self; - _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; _tableView.showsHorizontalScrollIndicator = NO; + [_tableView registerClass:[InspectSortTableCell class] forCellReuseIdentifier:kTaskSortCell]; + _tableView.tableHeaderView = self.detailHeaderView; [self.view addSubview:_tableView]; NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0]; diff --git a/redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m b/redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m index c2e0e0a41e80c03c3ba3dd2e5339bcd50b0b87ca..70438892c7a69d4a143bb881372ed1db6d8bd3ab 100644 --- a/redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m +++ b/redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m @@ -100,8 +100,8 @@ self.tableView.tableHeaderView = self.headView; self.pointLabel1.text = @"月度排å"; - self.pointLabel2.text = @"å‚与商家数é‡"; self.lineView.backgroundColor = kSeparateLineColor; + self.pointLabel2.text = @"å‚与商家数é‡"; self.lineView1.backgroundColor = kSeparateLineColor; self.shoppingCountLabel.textAlignment = NSTextAlignmentCenter; [self.dateButton addTarget:self action:@selector(changeDateClick:) forControlEvents:UIControlEventTouchUpInside]; @@ -385,7 +385,7 @@ NSLayoutConstraint *point1Top = [NSLayoutConstraint constraintWithItem:_pointLabel1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7]; [self.headView addConstraint:point1Top]; - NSLayoutConstraint *point1Right = [NSLayoutConstraint constraintWithItem:_pointLabel1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; + NSLayoutConstraint *point1Right = [NSLayoutConstraint constraintWithItem:_pointLabel1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:15]; [self.headView addConstraint:point1Right]; NSLayoutConstraint *point1Left = [NSLayoutConstraint constraintWithItem:_pointLabel1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; @@ -397,6 +397,32 @@ return _pointLabel1; } +- (UIView *)lineView +{ + if (!_lineView) { + _lineView = [[UIView alloc] init]; + _lineView.translatesAutoresizingMaskIntoConstraints = NO; + [self.headView addSubview:_lineView]; + + NSLayoutConstraint *point1Top = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10]; + [self.headView addConstraint:point1Top]; + + + + NSLayoutConstraint *point1Left = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.pointLabel1 attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; + [self.headView addConstraint:point1Left]; + + NSLayoutConstraint *point1Height = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50]; + [self.headView addConstraint:point1Height]; + + NSLayoutConstraint *point1Width = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0.5]; + [self.headView addConstraint:point1Width]; + + } + return _lineView; +} + + - (UILabel *)pointLabel2 { if (!_pointLabel2) { @@ -407,44 +433,19 @@ _pointLabel2.textAlignment = NSTextAlignmentCenter; [self.headView addSubview:_pointLabel2]; - NSLayoutConstraint *point2Top = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7]; - [self.headView addConstraint:point2Top]; + NSLayoutConstraint *point1Top = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7]; + [self.headView addConstraint:point1Top]; - NSLayoutConstraint *point2Right = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; - [self.headView addConstraint:point2Right]; + NSLayoutConstraint *point1Right = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-(kScreenWidth / 2 - 15 - 90) / 2]; + [self.headView addConstraint:point1Right]; - NSLayoutConstraint *point2Left = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:16]; - [self.headView addConstraint:point2Left]; - NSLayoutConstraint *point2Height = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30]; - [_pointLabel2 addConstraint:point2Height]; + NSLayoutConstraint *point1Height = [NSLayoutConstraint constraintWithItem:_pointLabel2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30]; + [self.headView addConstraint:point1Height]; } return _pointLabel2; } -- (UIView *)lineView -{ - if (!_lineView) { - _lineView = [[UILabel alloc] init]; - _lineView.translatesAutoresizingMaskIntoConstraints = NO; - [self.headView addSubview:_lineView]; - - - NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10]; - [self.headView addConstraint:lineTop]; - - NSLayoutConstraint *lineLeft = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:15]; - [self.headView addConstraint:lineLeft]; - - NSLayoutConstraint *lineWidth = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:0.5]; - [_lineView addConstraint:lineWidth]; - - NSLayoutConstraint *lineHeight = [NSLayoutConstraint constraintWithItem:_lineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50]; - [_lineView addConstraint:lineHeight]; - - } - return _lineView; -} - (DateButton *)dateButton { @@ -493,10 +494,7 @@ NSLayoutConstraint *shoppingCountTop = [NSLayoutConstraint constraintWithItem:_shoppingCountLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.pointLabel2 attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; [self.headView addConstraint:shoppingCountTop]; - NSLayoutConstraint *shoppingCountLeft = [NSLayoutConstraint constraintWithItem:_shoppingCountLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.lineView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; - [self.headView addConstraint:shoppingCountLeft]; - - NSLayoutConstraint *shoppingCountRight = [NSLayoutConstraint constraintWithItem:_shoppingCountLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; + NSLayoutConstraint *shoppingCountRight = [NSLayoutConstraint constraintWithItem:_shoppingCountLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.headView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-(kScreenWidth / 2 - 60) / 2]; [self.headView addConstraint:shoppingCountRight]; NSLayoutConstraint *shoppingCountHeight = [NSLayoutConstraint constraintWithItem:_shoppingCountLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];