Commit 4776d0ee authored by admin's avatar admin

完成 口碑详情 cell下拉效果

parent c2ff708d
This diff is collapsed.
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "launch_bg_6plus-1.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "launch_bg_6plus.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "launch_bg_6.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_6-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "launch_bg_6plus-2.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_4.png",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_5.png",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_6-2.png",
"extent" : "full-screen",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
bgButton.backgroundColor = [UIColor whiteColor]; bgButton.backgroundColor = [UIColor whiteColor];
bgButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; bgButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
bgButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10); bgButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
bgButton.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0); bgButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
[bgButton addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside]; [bgButton addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:bgButton]; [self addSubview:bgButton];
_bgButton = bgButton; _bgButton = bgButton;
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
TaskModel *task = taskGroup.classfiy[indexPath.row]; TaskModel *task = taskGroup.classfiy[indexPath.row];
cell.task = task; cell.task = task;
cell.titleLabel.text = [NSString stringWithFormat:@"%ld、%@", (indexPath.row + 1) ,task.intro]; cell.titleLabel.text = [NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1) ,task.intro];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
// cell的高度 // cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
return 45; return 44;
} }
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
...@@ -141,7 +141,6 @@ ...@@ -141,7 +141,6 @@
InspectHeaderView *headView = [InspectHeaderView headViewWithTableView:tableView]; InspectHeaderView *headView = [InspectHeaderView headViewWithTableView:tableView];
headView.delegate = self; headView.delegate = self;
headView.taskGroup = _taskData[section]; headView.taskGroup = _taskData[section];
return headView; return headView;
} }
......
//
// RankDetailTableCell.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankDetailTableCell : UITableViewCell
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UIButton *mainTitleBtn;
@property (nonatomic, strong) UILabel *scoreLabel;
@end
//
// RankDetailTableCell.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankDetailTableCell.h"
@implementation RankDetailTableCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
self.arrowImageView.image = [UIImage imageNamed:@"grey-trilateral_right"];
self.mainTitleBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
self.scoreLabel.textColor = kDateButtonTextColor;
}
#pragma mark - Lazy Loading
- (UIImageView *)arrowImageView
{
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView insertSubview:_arrowImageView aboveSubview:self.mainTitleBtn];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:18];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:8];
[self.contentView addConstraint:shoppingWidth];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12];
[self.contentView addConstraint:shoppingHeight];
}
return _arrowImageView;
}
- (UIButton *)mainTitleBtn
{
if (!_mainTitleBtn) {
_mainTitleBtn = [[UIButton alloc] init];
_mainTitleBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
_mainTitleBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_mainTitleBtn setTitleColor:kShopNameTextColor forState:UIControlStateNormal];
[self.contentView addSubview:_mainTitleBtn];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:2];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:37];
[self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.scoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:shoppingRight];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_mainTitleBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:42];
[self.contentView addConstraint:shoppingHeight];
}
return _mainTitleBtn;
}
- (UILabel *)scoreLabel
{
if (!_scoreLabel) {
_scoreLabel = [[UILabel alloc] init];
_scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_scoreLabel.textAlignment = NSTextAlignmentLeft;
_scoreLabel.font = [UIFont systemFontOfSize:17.0];
[self.contentView addSubview:_scoreLabel];
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:2];
[self.contentView addConstraint:scoreTop];
NSLayoutConstraint *scoreRight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:scoreRight];
NSLayoutConstraint *scoreWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self.contentView addConstraint:scoreWidth];
NSLayoutConstraint *scoreHeight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:42];
[self.contentView addConstraint:scoreHeight];
}
return _scoreLabel;
}
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// 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
//
// WorkModel.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WorkModel : NSObject
@property (nonatomic, strong) NSArray *Info;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *score;
@property (nonatomic, strong) NSString *grade;
@property (nonatomic, assign, getter = isOpened) BOOL opened;
+ (instancetype)workModelWithDict:(NSDictionary *)dict;
- (instancetype)initWithDict:(NSDictionary *)dict;
@end
//
// WorkModel.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "WorkModel.h"
@implementation WorkModel
+ (instancetype)workModelWithDict:(NSDictionary *)dict
{
return [[self alloc] initWithDict:dict];
}
- (instancetype)initWithDict:(NSDictionary *)dict
{
if (self = [super init]) {
[self setValuesForKeysWithDictionary:dict];
}
return self;
}
@end
//
// RankDetailHeaderView.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "RankDetailView.h"
@interface RankDetailHeaderView : UIView
@property (nonatomic, strong) RankDetailView *rankDetailView;
@property (nonatomic, strong) UILabel *shopNameLabel;
@property (nonatomic, strong) UIButton *historyBtn; // 历史成绩
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *showAllBtn; // 展开全部
@end
// //
// RankShopDetialCell.h // RankDetailView.h
// redstar // redstar
// //
// Created by admin on 15/10/29. // Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved. // Copyright © 2015年 ZWF. All rights reserved.
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface RankShopDetialCell : UITableViewCell @interface RankDetailView : UIView
@property (nonatomic, strong) UILabel *addressLabel; // 地址 @property (nonatomic, strong) UILabel *addressLabel; // 地址
@property (nonatomic, strong) UILabel *titleLabel; // 总标题 @property (nonatomic, strong) UILabel *titleLabel; // 总标题
@property (nonatomic, strong) UILabel *reportTimeLabel; // 上报时间 @property (nonatomic, strong) UILabel *reportTimeLabel; // 上报时间
...@@ -20,5 +20,4 @@ ...@@ -20,5 +20,4 @@
@property (nonatomic, strong) UILabel *gradeLabel; // 排名 @property (nonatomic, strong) UILabel *gradeLabel; // 排名
@property (nonatomic, strong) UIImageView *gradeImageView; // 排名 @property (nonatomic, strong) UIImageView *gradeImageView; // 排名
@property (nonatomic, strong) UIScrollView *showScrollView; // 轮播图 @property (nonatomic, strong) UIScrollView *showScrollView; // 轮播图
@end @end
//
// RankHeadView.h
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@class WorkModel;
@protocol RankHeadViewDelegate <NSObject>
@optional
- (void)clickRankHeadView;
@end
@interface RankHeadView : UITableViewHeaderFooterView
@property (nonatomic, strong) WorkModel *work;
@property (nonatomic, weak) id<RankHeadViewDelegate> delegate;
+ (instancetype)headViewWithTableView:(UITableView *)tableView;
@end
//
// RankHeadView.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankHeadView.h"
#import "WorkModel.h"
@interface RankHeadView ()
{
UIButton *_bgButton;
UIImageView *_arrowImageView;
UILabel *_scoreLabel; // 分数
UILabel *_gradeLabel; // 排名
UIView *_lineView;
}
@end
@implementation RankHeadView
+ (instancetype)headViewWithTableView:(UITableView *)tableView
{
static NSString *headIdentifier = @"header";
RankHeadView *headView = (RankHeadView *)[tableView dequeueReusableCellWithIdentifier:headIdentifier];
if (headView == nil) {
headView = [[RankHeadView alloc] initWithReuseIdentifier:headIdentifier];
}
return headView;
}
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
UIButton *bgButton = [UIButton buttonWithType:UIButtonTypeCustom];
bgButton.backgroundColor = [UIColor whiteColor];
bgButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
bgButton.contentEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 10);
bgButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
bgButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
[bgButton setTitleColor:kAnnounceTextColor forState:UIControlStateNormal];
[bgButton addTarget:self action:@selector(headBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:bgButton];
_bgButton = bgButton;
UIImageView *arrowIMView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow_down"]];
[self addSubview:arrowIMView];
_arrowImageView = arrowIMView;
UILabel *scoreLabel = [[UILabel alloc] init];
scoreLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:scoreLabel];
_scoreLabel = scoreLabel;
UILabel *gradeLabel = [[UILabel alloc] init];
gradeLabel.textAlignment = NSTextAlignmentCenter;
[self addSubview:gradeLabel];
_gradeLabel = gradeLabel;
UIView *lineView = [[UIView alloc] init];
lineView.backgroundColor = kSeparateLineColor;
[self addSubview:lineView];
_lineView = lineView;
}
return self;
}
- (void)headBtnClick
{
_work.opened = !_work.isOpened;
if ([_delegate respondsToSelector:@selector(clickRankHeadView)]) {
[_delegate clickRankHeadView];
}
}
- (void)setWork:(WorkModel *)work
{
_work = work;
[_bgButton setTitle:work.name forState:UIControlStateNormal];
NSString *scoreStr = [NSString stringWithFormat:@"%@ 分", work.score];
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)];
[_scoreLabel setAttributedText:scoreAttr];
NSString *rankStr = [NSString stringWithFormat:@"第 %@ 名", work.grade];
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)];
[_gradeLabel setAttributedText:rankAttr];
}
- (void)didMoveToSuperview
{
_arrowImageView.transform = _work.isOpened ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformMakeRotation(0);
_lineView.hidden = _work.isOpened ? YES : NO;
}
- (void)layoutSubviews
{
[super layoutSubviews];
_bgButton.frame = self.bounds;
_scoreLabel.frame = CGRectMake(self.frame.size.width - 193, 0, 80, self.frame.size.height);
_gradeLabel.frame = CGRectMake(self.frame.size.width - 113, 0, 80, self.frame.size.height);
_arrowImageView.frame = CGRectMake(self.frame.size.width - 33, (self.frame.size.height - 8) / 2, 13, 8);
_lineView.frame = CGRectMake(0, self.frame.size.height - 1, self.frame.size.width, 1);
}
@end
...@@ -10,4 +10,5 @@ ...@@ -10,4 +10,5 @@
@interface RankDetailViewController : UIViewController @interface RankDetailViewController : UIViewController
@property (nonatomic, assign) NSInteger indexRow; @property (nonatomic, assign) NSInteger indexRow;
@end @end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>info</key>
<array>
<dict>
<key>titles</key>
<string>大堂第一走道楼梯</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>大堂宣传条幅</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>广场吊旗</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>中庭地面</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
</array>
<key>name</key>
<string>全员服务</string>
<key>score</key>
<string>100</string>
<key>grade</key>
<string>1</string>
</dict>
<dict>
<key>info</key>
<array>
<dict>
<key>titles</key>
<string>退单速度</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>服务态度</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>服务质量</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
</array>
<key>name</key>
<string>十五分钟退单</string>
<key>score</key>
<string>100</string>
<key>grade</key>
<string>1</string>
</dict>
<dict>
<key>info</key>
<array>
<dict>
<key>titles</key>
<string>送货速度</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>送货上门态度</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>物品破损</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
</array>
<key>name</key>
<string>送货跟单</string>
<key>score</key>
<string>100</string>
<key>grade</key>
<string>1</string>
</dict>
<dict>
<key>info</key>
<array>
<dict>
<key>titles</key>
<string>大堂楼梯</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>厨房食堂</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>前台</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>大堂第一走道楼梯</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
</array>
<key>name</key>
<string>办公室</string>
<key>score</key>
<string>100</string>
<key>grade</key>
<string>1</string>
</dict>
<dict>
<key>info</key>
<array>
<dict>
<key>titles</key>
<string>小区绿化</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
<dict>
<key>titles</key>
<string>周边环境</string>
<key>scroes</key>
<string>5</string>
<key>pics</key>
<array>
<string>01.png</string>
<string>02.png</string>
<string>03.png</string>
</array>
</dict>
</array>
<key>name</key>
<string>物业环境改造</string>
<key>score</key>
<string>100</string>
<key>grade</key>
<string>1</string>
</dict>
</array>
</plist>
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