Commit cff96300 authored by admin's avatar admin

完成巡检列表UI 详情完成部分

parent 16252f9d
......@@ -10,6 +10,7 @@
2381E9EBA834CB171E43657A /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 083F3F95EB690FA24FEC0C8E /* libPods.a */; };
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */; };
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */; };
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */; };
8442BA5C1BDB8FDB005E5657 /* MineTableHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8442BA5B1BDB8FDB005E5657 /* MineTableHeaderView.m */; };
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 8474A01B1BE368D700315F30 /* HomeCellItem.m */; };
84846E971BE069BC0010550A /* DateButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 84846E961BE069BC0010550A /* DateButton.m */; };
......@@ -66,6 +67,8 @@
840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailViewController.m; sourceTree = "<group>"; };
840ABECD1BE20A53006E49C5 /* RankShopDetialCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankShopDetialCell.h; sourceTree = "<group>"; };
840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankShopDetialCell.m; sourceTree = "<group>"; };
841BBCDC1BE49E18007A21BF /* RankWorkDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankWorkDetailCell.h; sourceTree = "<group>"; };
841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankWorkDetailCell.m; sourceTree = "<group>"; };
8442BA5A1BDB8FDB005E5657 /* MineTableHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MineTableHeaderView.h; sourceTree = "<group>"; };
8442BA5B1BDB8FDB005E5657 /* MineTableHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MineTableHeaderView.m; sourceTree = "<group>"; };
8474A01A1BE368D700315F30 /* HomeCellItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeCellItem.h; sourceTree = "<group>"; };
......@@ -380,6 +383,8 @@
children = (
840ABECD1BE20A53006E49C5 /* RankShopDetialCell.h */,
840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */,
841BBCDC1BE49E18007A21BF /* RankWorkDetailCell.h */,
841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */,
);
path = Cell;
sourceTree = "<group>";
......@@ -911,6 +916,7 @@
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */,
84D8257F1BDD2F7E00CC61F7 /* MineTableFooterView.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */,
848699B31BDF810900859DFE /* InspectTaskViewController.m in Sources */,
848699B11BDF810900859DFE /* MenuButton.m in Sources */,
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */,
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "filter_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "filter_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sort_icon@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sort_icon@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -9,7 +9,7 @@
#ifndef Constant_h
#define Constant_h
#define kNavigationBarColor [UIColor colorWithRed:12 / 255.0 green:89/255.0 blue:172/255.0 alpha:1.0]
#define kNavigationBarColor [UIColor colorWithRed:0 / 255.0 green:111 / 255.0 blue:188 / 255.0 alpha:1.0]
#define kRemindTextColor [UIColor colorWithRed:133 / 255.0 green:133/255.0 blue:133/255.0 alpha:1.0]
#define kMineBackGroundColor [UIColor colorWithRed:243 / 255.0 green:243 / 255.0 blue:243 / 255.0 alpha:1.0]
#define kHomeSectionButtonTextColor [UIColor colorWithRed:186 / 255.0 green:186 / 255.0 blue:186 / 255.0 alpha:1.0]
......@@ -59,6 +59,30 @@
// #fe6903
#define kGradeNumberTextColor [UIColor colorWithRed:254 / 255.0 green:105 / 255.0 blue:3 / 255.0 alpha:1.0]
// RankingDetail
// #444444
#define kDetailSection0TitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// #999999
#define kDetailSection1TitleColor [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1.0]
// #999999
#define kDetailSmallTitleColor [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1.0]
// #444444
#define kDetailBigTitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// InspectList
// #f3f3f3
#define kInspectSectionBackGroundColor [UIColor colorWithRed:243 / 255.0 green:243 / 255.0 blue:243 / 255.0 alpha:1.0]
#define kInspectSectionButtonTextColor [UIColor colorWithRed:97 / 255.0 green:97 / 255.0 blue:97 / 255.0 alpha:1.0]
#define kCellTitleColor [UIColor colorWithRed:53 / 255.0 green:53 / 255.0 blue:53 / 255.0 alpha:1.0]
#define kCellDetailColor [UIColor colorWithRed:83 / 255.0 green:83 / 255.0 blue:83 / 255.0 alpha:1.0]
#define kProgressUnSettledColor [UIColor colorWithRed:255 / 255.0 green:0 / 255.0 blue:0 / 255.0 alpha:1.0]
#define kProgressDealWithColor [UIColor colorWithRed:49 / 255.0 green:57 / 255.0 blue:126 / 255.0 alpha:1.0]
#define kProgressOverDueColor [UIColor colorWithRed:117 / 255.0 green:117 / 255.0 blue:117 / 255.0 alpha:1.0]
#define kProgressViewAllBackColor [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1.0]
#define kProgressViewAlreadyBackColor [UIColor colorWithRed:112 / 255.0 green:120 / 255.0 blue:216 / 255.0 alpha:1.0]
#import "UIView+Extension.h"
#endif /* Constant_h */
......@@ -7,14 +7,23 @@
//
#import <UIKit/UIKit.h>
typedef enum ProgressState : NSUInteger {
ProgressStateUnSettled = 0,// 未处理
ProgressStateDealWith, // 处理中
ProgressStateOverDue // 已过期
} ProgressState;
@interface InspectListCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel; // 标题
@property (nonatomic, strong) UILabel *startDate; // 起始日期
@property (nonatomic, strong) UILabel *overDate; // 截止日期
@property (nonatomic, strong) UILabel *checkPointLabel; // 检查点
@property (nonatomic, strong) UILabel *completeLabel; // 已完成
@property (nonatomic, strong) UIProgressView *progressView; // 进度条
@property (nonatomic, strong) UILabel *progressLabel; // 进度
@property (nonatomic, strong) UILabel *taskStateLabel; // 任务的状态
@property (nonatomic, assign) ProgressState progressState; // 处理进度
@property (nonatomic, strong) UILabel *alreadyLabel;
@property (nonatomic, strong) UILabel *allLabel;
@property (nonatomic, assign) CGFloat multiplier; // 乘数
@property (nonatomic, strong) UIView *alreadyView;
@property (nonatomic, strong) UIView *allView;
@end
......@@ -8,6 +8,12 @@
#import "InspectListCell.h"
@interface InspectListCell ()
@property (nonatomic, strong) UILabel *progressLabel;
@end
@implementation InspectListCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
......@@ -22,14 +28,47 @@
#pragma mark - Private Methods
- (void)setup
{
self.titleLabel.font = [UIFont boldSystemFontOfSize:20.0];
self.taskStateLabel.text = @"进行中";
self.startDate.textColor = kHomeSectionButtonTextColor;
self.overDate.textColor = kHomeSectionButtonTextColor;
self.checkPointLabel.textColor = kHomeSectionButtonTextColor;
self.completeLabel.textColor = kHomeSectionButtonTextColor;
self.progressView.progressViewStyle = UIProgressViewStyleBar;
self.progressLabel.font = [UIFont boldSystemFontOfSize:18.0];
self.titleLabel.font = [UIFont systemFontOfSize:19.0];
self.startDate.textColor = kCellDetailColor;
self.overDate.textColor = kCellDetailColor;
self.progressLabel.font = [UIFont systemFontOfSize:14.0];
self.alreadyLabel.font = [UIFont systemFontOfSize:15.0];
self.allLabel.font = [UIFont systemFontOfSize:15.0];
}
- (void)setProgressState:(ProgressState)progressState
{
_progressState = progressState;
if (_progressState == ProgressStateUnSettled) {
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:kProgressUnSettledColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressUnSettledColor;
self.allLabel.textColor = kProgressUnSettledColor;
} else if (_progressState == ProgressStateDealWith) {
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 {
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:kProgressOverDueColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(5,str.length - 5)];
[self.progressLabel setAttributedText:strAttr];
self.alreadyLabel.textColor = kProgressOverDueColor;
self.allLabel.textColor = kProgressOverDueColor;
}
}
#pragma mark - lazy Loading
......@@ -37,16 +76,17 @@
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = kCellTitleColor;
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:8];
[self.contentView addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.progressLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
NSLayoutConstraint *titleLabelRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:titleLabelRight];
NSLayoutConstraint *titleLabelHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
......@@ -60,7 +100,7 @@
if (!_startDate) {
_startDate = [[UILabel alloc] init];
_startDate.translatesAutoresizingMaskIntoConstraints = NO;
_startDate.font = [UIFont systemFontOfSize:15.0];
_startDate.font = [UIFont systemFontOfSize:14.0];
[self.contentView addSubview:_startDate];
NSLayoutConstraint *startDateTop = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
......@@ -72,7 +112,7 @@
NSLayoutConstraint *startDateRight = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:startDateRight];
NSLayoutConstraint *startDateHeight = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
NSLayoutConstraint *startDateHeight = [NSLayoutConstraint constraintWithItem:_startDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:startDateHeight];
}
......@@ -83,7 +123,7 @@
{
if (!_overDate) {
_overDate = [[UILabel alloc] init];
_overDate.font = [UIFont systemFontOfSize:15.0];
_overDate.font = [UIFont systemFontOfSize:14.0];
_overDate.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_overDate];
......@@ -97,127 +137,136 @@
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_overDate attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _overDate;
}
- (UILabel *)checkPointLabel
- (UILabel *)progressLabel
{
if (!_checkPointLabel) {
_checkPointLabel = [[UILabel alloc] init];
_checkPointLabel.font = [UIFont systemFontOfSize:15.0];
_checkPointLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_checkPointLabel];
NSLayoutConstraint *checkPointTop = [NSLayoutConstraint constraintWithItem:_checkPointLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:checkPointTop];
if (!_progressLabel) {
_progressLabel = [[UILabel alloc] init];
_progressLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_progressLabel];
NSLayoutConstraint *checkPointLeft = [NSLayoutConstraint constraintWithItem:_checkPointLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:checkPointLeft];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *checkPointWidth = [NSLayoutConstraint constraintWithItem:_checkPointLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[self.contentView addConstraint:checkPointWidth];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *checkPointHeight = [NSLayoutConstraint constraintWithItem:_checkPointLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:checkPointHeight];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.alreadyLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _checkPointLabel;
return _progressLabel;
}
- (UILabel *)completeLabel
- (UILabel *)alreadyLabel
{
if (!_completeLabel) {
_completeLabel = [[UILabel alloc] init];
_completeLabel.font = [UIFont systemFontOfSize:15.0];
_completeLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_completeLabel];
if (!_alreadyLabel) {
_alreadyLabel = [[UILabel alloc] init];
_alreadyLabel.textAlignment = NSTextAlignmentRight;
_alreadyLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_alreadyLabel];
NSLayoutConstraint *completeTop = [NSLayoutConstraint constraintWithItem:_completeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:completeTop];
NSLayoutConstraint *completeLeft = [NSLayoutConstraint constraintWithItem:_completeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_checkPointLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:completeLeft];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *completeRight = [NSLayoutConstraint constraintWithItem:_completeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:completeRight];
NSLayoutConstraint *overDateWidth = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateWidth];
NSLayoutConstraint *completeHeight = [NSLayoutConstraint constraintWithItem:_completeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:completeHeight];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.allLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_alreadyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
return _completeLabel;
return _alreadyLabel;
}
- (UIProgressView *)progressView
- (UILabel *)allLabel
{
if (!_progressView) {
_progressView = [[UIProgressView alloc] init];
_progressView.backgroundColor = [UIColor redColor];
_progressView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_progressView];
if (!_allLabel) {
_allLabel = [[UILabel alloc] init];
_allLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_allLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.overDate attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateWidth = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:32];
[self.contentView addConstraint:overDateWidth];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-18];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateHeight];
}
NSLayoutConstraint *progressViewTop = [NSLayoutConstraint constraintWithItem:_progressView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_checkPointLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:progressViewTop];
NSLayoutConstraint *progressViewLeft = [NSLayoutConstraint constraintWithItem:_progressView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:progressViewLeft];
NSLayoutConstraint *progressViewRight = [NSLayoutConstraint constraintWithItem:_progressView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.progressLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-20];
[self.contentView addConstraint:progressViewRight];
NSLayoutConstraint *progressViewHeight = [NSLayoutConstraint constraintWithItem:_progressView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:progressViewHeight];
return _progressView;
return _allLabel;
}
- (UILabel *)progressLabel
- (UIView *)allView
{
if (!_progressLabel) {
_progressLabel = [[UILabel alloc] init];
_progressLabel.backgroundColor = [UIColor lightGrayColor];
_progressLabel.textColor = [UIColor whiteColor];
_progressLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_progressLabel];
NSLayoutConstraint *progressLabelTop = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.checkPointLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:progressLabelTop];
if (!_allView) {
_allView = [[UIView alloc] init];
_allView.translatesAutoresizingMaskIntoConstraints = NO;
_allView.layer.cornerRadius = 3;
_allView.layer.masksToBounds = YES;
_allView.layer.borderWidth = 1;
_allView.layer.borderColor = kUsernameBorderColor;
[self.contentView addSubview:_allView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.progressLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *progressLabelWidth = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:50];
[self.contentView addConstraint:progressLabelWidth];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *progressLabelRight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:progressLabelRight];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *progressLabelHeight = [NSLayoutConstraint constraintWithItem:_progressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:progressLabelHeight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:overDateHeight];
}
return _progressLabel;
return _allView;
}
- (UILabel *)taskStateLabel
- (UIView *)alreadyView
{
if (!_taskStateLabel) {
_taskStateLabel = [[UILabel alloc] init];
_taskStateLabel.backgroundColor = [UIColor greenColor];
_taskStateLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_taskStateLabel];
if (!_alreadyView) {
_alreadyView = [[UIView alloc] init];
_alreadyView.layer.cornerRadius = 3;
_alreadyView.layer.masksToBounds = YES;
_alreadyView.translatesAutoresizingMaskIntoConstraints = NO;
[self.allView addSubview:_alreadyView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.allView addConstraint:overDateTop];
NSLayoutConstraint *taskStateTop = [NSLayoutConstraint constraintWithItem:_taskStateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:taskStateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:1];
[self.allView addConstraint:overDateLeft];
NSLayoutConstraint *taskStateWidth = [NSLayoutConstraint constraintWithItem:_taskStateLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[_taskStateLabel addConstraint:taskStateWidth];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-1];
[self.allView addConstraint:overDateBottom];
NSLayoutConstraint *taskStateRight = [NSLayoutConstraint constraintWithItem:_taskStateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:taskStateRight];
NSLayoutConstraint *overDatewidth = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeWidth multiplier:_multiplier constant:-1];
[self.allView addConstraint:overDatewidth];
NSLayoutConstraint *taskStateHeight = [NSLayoutConstraint constraintWithItem:_taskStateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[_taskStateLabel addConstraint:taskStateHeight];
}
return _taskStateLabel;
return _alreadyView;
}
@end
......@@ -14,12 +14,12 @@
{
CGFloat w = self.frame.size.width;
CGFloat h = self.frame.size.height;
return CGRectMake(w / 2 - 40, 0, 40, h);
return CGRectMake(w / 2 - 30, 0, 32, h);
}
- (CGRect)imageRectForContentRect:(CGRect)contentRect;
{
CGFloat w = self.frame.size.width;
return CGRectMake(w / 2, 7, 26, 26);
return CGRectMake(w / 2 + 3, 15, 13, 15);
}
- (void)setHighlighted:(BOOL)highlighted {
......
......@@ -16,6 +16,13 @@
@interface InspectListViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@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;
@end
@implementation InspectListViewController
......@@ -30,6 +37,15 @@
self.navigationItem.titleView = customLab;
[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];
}
- (void)viewWillAppear:(BOOL)animated
......@@ -47,7 +63,7 @@
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 7;
return 5;
}
// cell显示的内容
......@@ -58,12 +74,23 @@
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectListCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.titleLabel.text = @"2015年9月口碑巡检";
cell.startDate.text = @"起始时间:2015-09-01";
cell.overDate.text = @"起始时间:2015-09-01";
cell.checkPointLabel.text = @"16个检查点";
cell.completeLabel.text = @"| 完成数:10";
cell.progressLabel.text = @"60%";
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;
}
......@@ -77,13 +104,13 @@
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 150;
return 145;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40;
return 45;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
......@@ -97,14 +124,14 @@
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = [UIColor whiteColor];
sectionView.backgroundColor = kInspectSectionBackGroundColor;
UIView *lineView = [[UIView alloc] init];
lineView.translatesAutoresizingMaskIntoConstraints = NO;
lineView.backgroundColor = [UIColor blackColor];
lineView.backgroundColor = kSeparateLineColor;
[sectionView addSubview:lineView];
NSLayoutConstraint *lineTop = [NSLayoutConstraint constraintWithItem:lineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
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];
......@@ -113,22 +140,22 @@
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:-5];
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:[UIColor blackColor] forState:UIControlStateNormal];
[taxiButton setImage:[UIImage imageNamed:@"tabbar_discover"] forState:UIControlStateNormal];
taxiButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
[taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[taxiButton setImage:[UIImage imageNamed:@"sort_icon"] forState:UIControlStateNormal];
taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[taxiButton setTitle:@"排序" forState:UIControlStateNormal];
[sectionView addSubview:taxiButton];
MenuButton *screenButton = [[MenuButton alloc] init];
screenButton.translatesAutoresizingMaskIntoConstraints = NO;
[screenButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[screenButton setImage:[UIImage imageNamed:@"tabbar_discover"] forState:UIControlStateNormal];
screenButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
[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];
......
......@@ -10,13 +10,15 @@
@interface RankShopDetialCell : UITableViewCell
@property (nonatomic, strong) UILabel *addressLabel; // 地址
@property (nonatomic, strong) UILabel *dateLabel; //
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
//@property (nonatomic, strong) UILabel *addressLabel; // 地址
@property (nonatomic, strong) UILabel *titleLabel; // 总标题
@property (nonatomic, strong) UILabel *reportTimeLabel; // 上报时间
@property (nonatomic, strong) UILabel *totalScoreLabel; // 总评分
@property (nonatomic, strong) UILabel *totalGradeLabel; // 总排名
@property (nonatomic, strong) UILabel *timeLabel; // 时间
@property (nonatomic, strong) UILabel *scoreLabel; // 分数
@property (nonatomic, strong) UIView *gradeView; // 排名
@property (nonatomic, strong) UILabel *gradeLabel; // 排名
@property (nonatomic, strong) UIImageView *gradeImageView; // 排名
@property (nonatomic, strong) UIScrollView *showScrollView; // 轮播图
@end
......@@ -8,6 +8,13 @@
#import "RankShopDetialCell.h"
@interface RankShopDetialCell ()
@property (nonatomic, strong) UIView *lineView1;
@property (nonatomic, strong) UIView *lineView2;
@end
@implementation RankShopDetialCell
#pragma mark - System Methods
......@@ -23,9 +30,324 @@
#pragma mark - Private Methods
- (void)setup
{
self.addressLabel.font = [UIFont systemFontOfSize:14.0];
self.showScrollView.backgroundColor = [UIColor lightGrayColor];
self.titleLabel.font = [UIFont systemFontOfSize:17.0];
self.reportTimeLabel.font = [UIFont systemFontOfSize:14.0];
self.lineView1.backgroundColor = kSeparateLineColor;
self.totalScoreLabel.font = [UIFont systemFontOfSize:14.0];
self.lineView2.backgroundColor = kSeparateLineColor;
self.totalGradeLabel.font = [UIFont systemFontOfSize:14.0];
self.timeLabel.font = [UIFont systemFontOfSize:16.0];
self.scoreLabel.font = [UIFont systemFontOfSize:17.0];
self.gradeView.backgroundColor = [UIColor clearColor];
}
#pragma mark - Lazy Loading
- (UILabel *)addressLabel
{
if (!_addressLabel) {
_addressLabel = [[UILabel alloc] init];
_addressLabel.translatesAutoresizingMaskIntoConstraints = NO;
_addressLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_addressLabel];
NSLayoutConstraint *addressTop = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:addressTop];
NSLayoutConstraint *addressLeft = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:addressLeft];
NSLayoutConstraint *addressRight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:addressRight];
NSLayoutConstraint *addressHeight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[self.contentView addConstraint:addressHeight];
}
return _addressLabel;
}
- (UIScrollView *)showScrollView
{
if (!_showScrollView) {
_showScrollView = [[UIScrollView alloc] init];
_showScrollView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_showScrollView];
NSLayoutConstraint *showTop = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.addressLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:showTop];
NSLayoutConstraint *showLeft = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:showLeft];
NSLayoutConstraint *showRight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:showRight];
NSLayoutConstraint *showHeight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:70];
[self.contentView addConstraint:showHeight];
}
return _showScrollView;
}
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.textColor = kDetailBigTitleColor;
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.showScrollView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleTop];
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
[self.contentView addConstraint:titleHeight];
}
return _titleLabel;
}
- (UILabel *)reportTimeLabel
{
if (!_reportTimeLabel) {
_reportTimeLabel = [[UILabel alloc] init];
_reportTimeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_reportTimeLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_reportTimeLabel];
NSLayoutConstraint *reportTop = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
[self.contentView addConstraint:reportTop];
NSLayoutConstraint *reportLeft = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:reportLeft];
NSLayoutConstraint *reportRight = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:reportRight];
NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:reportHeight];
NSLayoutConstraint *reportWidth = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.totalScoreLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:reportWidth];
}
return _reportTimeLabel;
}
- (UIView *)lineView1
{
if (!_lineView1) {
_lineView1 = [[UIView alloc] init];
_lineView1.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_lineView1];
NSLayoutConstraint *lineView1Top = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
[self.contentView addConstraint:lineView1Top];
NSLayoutConstraint *lineView1Bottom = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
[self.contentView addConstraint:lineView1Bottom];
NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.totalScoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:lineView1Right];
NSLayoutConstraint *lineView1Width = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self.contentView addConstraint:lineView1Width];
}
return _lineView1;
}
- (UILabel *)totalScoreLabel
{
if (!_totalScoreLabel) {
_totalScoreLabel = [[UILabel alloc] init];
_totalScoreLabel.textAlignment = NSTextAlignmentCenter;
_totalScoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_totalScoreLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_totalScoreLabel];
NSLayoutConstraint *reportTop = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
[self.contentView addConstraint:reportTop];
NSLayoutConstraint *reportRight = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:reportRight];
NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:reportHeight];
NSLayoutConstraint *reportWidth = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:reportWidth];
}
return _totalScoreLabel;
}
- (UIView *)lineView2
{
if (!_lineView2) {
_lineView2 = [[UIView alloc] init];
_lineView2.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_lineView2];
NSLayoutConstraint *lineView2Top = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:12];
[self.contentView addConstraint:lineView2Top];
NSLayoutConstraint *lineView2Bottom = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
[self.contentView addConstraint:lineView2Bottom];
NSLayoutConstraint *lineView2Right = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:lineView2Right];
NSLayoutConstraint *lineView2Width = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self.contentView addConstraint:lineView2Width];
}
return _lineView2;
}
- (UILabel *)totalGradeLabel
{
if (!_totalGradeLabel) {
_totalGradeLabel = [[UILabel alloc] init];
_totalGradeLabel.textAlignment = NSTextAlignmentCenter;
_totalGradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_totalGradeLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_totalGradeLabel];
NSLayoutConstraint *totalGradeTop = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
[self.contentView addConstraint:totalGradeTop];
NSLayoutConstraint *totalGradeRight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeRight];
NSLayoutConstraint *totalGradeHeight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:totalGradeHeight];
}
return _totalGradeLabel;
}
- (UILabel *)timeLabel
{
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.textColor = kDetailBigTitleColor;
_timeLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_timeLabel];
NSLayoutConstraint *timeTop = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_reportTimeLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:timeTop];
NSLayoutConstraint *timeLeft = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:timeLeft];
NSLayoutConstraint *timeRight = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:timeRight];
NSLayoutConstraint *timeHeight = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:timeHeight];
}
return _timeLabel;
}
- (UILabel *)scoreLabel
{
if (!_scoreLabel) {
_scoreLabel = [[UILabel alloc] init];
_scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_scoreLabel.textColor = kNavigationBarColor;
_scoreLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:_scoreLabel];
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreTop];
NSLayoutConstraint *scoreRight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.lineView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreRight];
NSLayoutConstraint *scoreHeight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:scoreHeight];
NSLayoutConstraint *scoreWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreWidth];
}
return _scoreLabel;
}
- (UIView *)gradeView
{
if (!_gradeView) {
_gradeView = [[UIView alloc] init];
_gradeView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_gradeView];
NSLayoutConstraint *totalGradeTop = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.totalGradeLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeTop];
NSLayoutConstraint *totalGradeLeft = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_lineView2 attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeLeft];
NSLayoutConstraint *totalGradeRight = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeRight];
NSLayoutConstraint *totalGradeBottom = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeBottom];
}
return _gradeView;
}
- (UILabel *)gradeLabel
{
if (!_gradeLabel) {
_gradeLabel = [[UILabel alloc] init];
_gradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_gradeLabel.textAlignment = NSTextAlignmentCenter;
[self.gradeView addSubview:_gradeLabel];
//
NSLayoutConstraint *gradeTop = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.gradeView addConstraint:gradeTop];
NSLayoutConstraint *gradeRight = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.gradeView addConstraint:gradeRight];
NSLayoutConstraint *gradeHeight = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.gradeView addConstraint:gradeHeight];
NSLayoutConstraint *gradeLeft = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.gradeView addConstraint:gradeLeft];
}
return _gradeLabel;
}
- (UIImageView *)gradeImageView
{
if (!_gradeImageView) {
_gradeImageView = [[UIImageView alloc] init];
_gradeImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.gradeView addSubview:_gradeImageView];
//
NSLayoutConstraint *gradeCenterX = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0];
[self.gradeView addConstraint:gradeCenterX];
NSLayoutConstraint *gradeCenterY = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.gradeView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0];
[self.gradeView addConstraint:gradeCenterY];
NSLayoutConstraint *gradeWidth = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
[self.gradeView addConstraint:gradeWidth];
NSLayoutConstraint *gradeHeight = [NSLayoutConstraint constraintWithItem:_gradeImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:34];
[self.gradeView addConstraint:gradeHeight];
}
return _gradeImageView;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// RankWorkDetailCell.h
// redstar
//
// Created by admin on 15/10/31.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankWorkDetailCell : UITableViewCell
@property (nonatomic, strong) UILabel *workNameLabel; // 工作名称
@property (nonatomic, strong) UILabel *scoreLabel; // 分数
@property (nonatomic, strong) UILabel *gradeLabel; // 排名
@property (nonatomic, strong) UIImageView *arrowImageView; // 箭头
@end
//
// RankWorkDetailCell.m
// redstar
//
// Created by admin on 15/10/31.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankWorkDetailCell.h"
@implementation RankWorkDetailCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.workNameLabel.font = [UIFont systemFontOfSize:18.0];
self.arrowImageView.backgroundColor = [UIColor clearColor];
}
#pragma mark - lazy laoding
- (UILabel *)workNameLabel
{
if (!_workNameLabel) {
_workNameLabel = [[UILabel alloc] init];
_workNameLabel.translatesAutoresizingMaskIntoConstraints = NO;
_workNameLabel.textColor = kDetailBigTitleColor;
[self.contentView addSubview:_workNameLabel];
NSLayoutConstraint *workNameTop = [NSLayoutConstraint constraintWithItem:_workNameLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:workNameTop];
NSLayoutConstraint *workNameLeft = [NSLayoutConstraint constraintWithItem:_workNameLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:workNameLeft];
NSLayoutConstraint *workNameBottom = [NSLayoutConstraint constraintWithItem:_workNameLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:workNameBottom];
NSLayoutConstraint *workNameRight = [NSLayoutConstraint constraintWithItem:_workNameLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.scoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-5];
[self.contentView addConstraint:workNameRight];
}
return _workNameLabel;
}
- (UILabel *)scoreLabel
{
if (!_scoreLabel) {
_scoreLabel = [[UILabel alloc] init];
_scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_scoreLabel.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:_scoreLabel];
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreTop];
NSLayoutConstraint *scoreWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:scoreWidth];
NSLayoutConstraint *scoreBottom = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreBottom];
NSLayoutConstraint *scoreRight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.gradeLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-10];
[self.contentView addConstraint:scoreRight];
}
return _scoreLabel;
}
- (UILabel *)gradeLabel
{
if (!_gradeLabel) {
_gradeLabel = [[UILabel alloc] init];
_gradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_gradeLabel.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:_gradeLabel];
NSLayoutConstraint *gradeTop = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.contentView addConstraint:gradeTop];
NSLayoutConstraint *gradeWidth = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:gradeWidth];
NSLayoutConstraint *gradeBottom = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:gradeBottom];
NSLayoutConstraint *gradeRight = [NSLayoutConstraint constraintWithItem:_gradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.arrowImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-5];
[self.contentView addConstraint:gradeRight];
}
return _gradeLabel;
}
- (UIImageView *)arrowImageView
{
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_arrowImageView];
NSLayoutConstraint *arrowTop = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:18];
[self.contentView addConstraint:arrowTop];
NSLayoutConstraint *arrowRight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:arrowRight];
NSLayoutConstraint *arrowHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:14];
[self.contentView addConstraint:arrowHeight];
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:14];
[self.contentView addConstraint:arrowWidth];
}
return _arrowImageView;
}
@end
......@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface RankDetailViewController : UIViewController
@property (nonatomic, assign) NSInteger indexRow;
@end
......@@ -7,11 +7,19 @@
//
#import "RankDetailViewController.h"
#import "RankShopDetialCell.h"
#import "RankWorkDetailCell.h"
#define kRankDetailFirstCell @"rankDetailFirstCell"
#define kRankDetailFirstCell @"RankShopDetialCell"
#define kRankDetailSecondCell @"RankWorkDetailCell"
@interface RankDetailViewController () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSArray *test1Array;
@property (nonatomic, strong) NSArray *test2Array;
@property (nonatomic, strong) NSArray *test3Array;
@end
@implementation RankDetailViewController
......@@ -30,6 +38,10 @@
// 添加tableView
[self addTableView];
self.test1Array = [NSArray arrayWithObjects:@"全员服务",@"15分钟退单",@"送货跟单",@"企划环境升级",@"物业环境改造", nil];
self.test2Array = [NSArray arrayWithObjects:@(100),@(100),@(99),@(100),@(98), nil];
self.test3Array = [NSArray arrayWithObjects:@(1),@(1),@(2),@(1),@(3), nil];
}
......@@ -41,7 +53,8 @@
#pragma mark - Private Methods
- (void)addTableView {
// 注册cell
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kRankDetailFirstCell];
[self.tableView registerClass:[RankShopDetialCell class] forCellReuseIdentifier:kRankDetailFirstCell];
[self.tableView registerClass:[RankWorkDetailCell class] forCellReuseIdentifier:kRankDetailSecondCell];
}
#pragma mark - UITableView DataSource/Delegate
......@@ -62,15 +75,56 @@
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailFirstCell];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailFirstCell];
if (indexPath.section == 0) {
RankShopDetialCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailFirstCell];
if (!cell) {
cell = [[RankShopDetialCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailFirstCell];
}
cell.addressLabel.text = @"上海市真北路1108号";
cell.titleLabel.text = @"2015年8月口碑巡检";
cell.reportTimeLabel.text = @"上报时间";
cell.totalScoreLabel.text = @"总评分";
cell.totalGradeLabel.text = @"总排名";
cell.timeLabel.text = @"2015-08-15";
cell.scoreLabel.text = @"100";
if (self.indexRow < 3) {
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(_indexRow + 1)];
cell.gradeImageView.image = [UIImage imageNamed:imageName];
} else {
NSString *rankStr = [NSString stringWithFormat:@"第 %ld 名", (long)(_indexRow + 1)];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldMT" size:18.0] range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(rankStr.length - 1,1)];
[cell.gradeLabel setAttributedText:rankAttr];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
RankWorkDetailCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailSecondCell];
if (!cell) {
cell = [[RankWorkDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailSecondCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.workNameLabel.text = _test1Array[indexPath.row];
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", _test2Array[indexPath.row]];
NSMutableAttributedString *scoreAttr = [[NSMutableAttributedString alloc] initWithString:scoreStr];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kNavigationBarColor,NSFontAttributeName:[UIFont systemFontOfSize:19.0f]} range:NSMakeRange(0,scoreAttr.length - 1)];
[scoreAttr addAttributes:@{NSForegroundColorAttributeName:kDetailSmallTitleColor, NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(scoreAttr.length - 1,1)];
[cell.scoreLabel setAttributedText:scoreAttr];
NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", _test3Array[indexPath.row]];
NSMutableAttributedString *rankAttr = [[NSMutableAttributedString alloc] initWithString:rankStr];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(0,1)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kGradeNumberTextColor} range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldMT" size:18.0] range:NSMakeRange(1,rankStr.length - 2)];
[rankAttr addAttributes:@{NSForegroundColorAttributeName:kRankHeadTitleTextColor,NSFontAttributeName:[UIFont systemFontOfSize:14.0f]} range:NSMakeRange(rankStr.length - 1,1)];
[cell.gradeLabel setAttributedText:rankAttr];
return cell;
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
// cell的点击事件
......@@ -82,8 +136,10 @@
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 45;
if (indexPath.section == 0) {
return 208;
}
return 50;
}
// section高度
......@@ -116,18 +172,19 @@
UIImageView *arrowImageView = [[UIImageView alloc] init];
arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
arrowImageView.backgroundColor = [UIColor orangeColor];
arrowImageView.image = [UIImage imageNamed:@"arrow_right"];
[sectionView addSubview:arrowImageView];
if (section == 0) {
titleLabel.text = @"上海真北店";
titleLabel.textColor = [UIColor blackColor];
[clickButton setTitleColor:kHomeSectionButtonTextColor forState:UIControlStateNormal];
titleLabel.textColor = kDetailSection0TitleColor;
titleLabel.font = [UIFont systemFontOfSize:18.0];
[clickButton setTitleColor:kDetailSection1TitleColor forState:UIControlStateNormal];
[clickButton setTitle:@"历史成绩" forState:UIControlStateNormal];
} else {
titleLabel.text = @"口碑七大重点工作详情";
titleLabel.textColor = kHomeSectionButtonTextColor;
titleLabel.font = [UIFont systemFontOfSize:16.0];
titleLabel.textColor = kDetailSection1TitleColor;
titleLabel.font = [UIFont systemFontOfSize:17.0];
[clickButton setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[clickButton setTitle:@"展开全部" forState:UIControlStateNormal];
}
......@@ -139,7 +196,7 @@
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[sectionView addConstraint:titleLeft];
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:160];
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:170];
[sectionView addConstraint:titleWidth];
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
......@@ -149,7 +206,7 @@
NSLayoutConstraint *clickTop = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:clickTop];
NSLayoutConstraint *clickRight = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:arrowImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
NSLayoutConstraint *clickRight = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:arrowImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-3];
[sectionView addConstraint:clickRight];
NSLayoutConstraint *clickWidth = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
......@@ -159,16 +216,16 @@
[sectionView addConstraint:clickBottom];
// button
NSLayoutConstraint *arrowTop = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:15];
NSLayoutConstraint *arrowTop = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:16];
[sectionView addConstraint:arrowTop];
NSLayoutConstraint *arrowRight = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[sectionView addConstraint:arrowRight];
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:15];
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7];
[sectionView addConstraint:arrowWidth];
NSLayoutConstraint *arrowBottom = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:15];
NSLayoutConstraint *arrowBottom = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:13];
[sectionView addConstraint:arrowBottom];
return sectionView;
}
......
......@@ -225,6 +225,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
rankDetailVC.indexRow = indexPath.row;
[self.navigationController pushViewController:rankDetailVC animated:YES];
}
......
......@@ -76,12 +76,13 @@
- (void)wordOfMouthClick:(UIButton *)sender
{
// InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
// [self.navigationController pushViewController:inspectListVC animated:YES];
RankingListViewController *rankListVC = [[RankingListViewController alloc] init];
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:rankListVC animated:YES];
[self.navigationController pushViewController:inspectListVC animated:YES];
// RankingListViewController *rankListVC = [[RankingListViewController alloc] init];
// self.hidesBottomBarWhenPushed = YES;
// [self.navigationController pushViewController:rankListVC animated:YES];
}
- (void)questionClick:(UIButton *)sender
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment