Commit 4776d0ee authored by admin's avatar admin

完成 口碑详情 cell下拉效果

parent c2ff708d
......@@ -12,9 +12,7 @@
8408261E1BE5D22A0022B795 /* OnLineTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8408261D1BE5D22A0022B795 /* OnLineTableViewCell.m */; };
840826211BE5D2400022B795 /* OnLineFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 840826201BE5D2400022B795 /* OnLineFooterView.m */; };
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */; };
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */; };
8419EAD41BEDC98F002635ED /* HttpClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 8419EAD31BEDC98F002635ED /* HttpClient.m */; };
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */; };
841D24F81BEB473C0005CC9F /* CheckPicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24F71BEB473C0005CC9F /* CheckPicViewController.m */; };
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24FA1BEB75CA0005CC9F /* QuestionDetailFooterView.m */; };
842547FC1BF03977006C79C5 /* QuestionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 842547FB1BF03977006C79C5 /* QuestionModel.m */; };
......@@ -52,6 +50,12 @@
84AD4F2F1BF4370E00BFB37C /* InspectHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F2E1BF4370E00BFB37C /* InspectHeaderView.m */; };
84AD4F321BF443E700BFB37C /* InspectDetailHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F311BF443E700BFB37C /* InspectDetailHeaderView.m */; };
84AD4F361BF45BEB00BFB37C /* InspectSortTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F351BF45BEB00BFB37C /* InspectSortTableCell.m */; };
84AD4F3A1BF4844600BFB37C /* RankDetailHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F391BF4844600BFB37C /* RankDetailHeaderView.m */; };
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */; };
84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84AD4F3E1BF498A900BFB37C /* ranking.plist */; };
84AD4F431BF4A66F00BFB37C /* WorkModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F421BF4A66F00BFB37C /* WorkModel.m */; };
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F451BF4A9E800BFB37C /* RankHeadView.m */; };
84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */; };
84C582EC1BDDFB0400AF838D /* HomeFunctionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C582EB1BDDFB0400AF838D /* HomeFunctionCell.m */; };
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574A1BDB344900083584 /* UIBarButtonItem+Create.m */; };
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 84C9574C1BDB344900083584 /* UIView+Frame.m */; };
......@@ -108,12 +112,8 @@
840826201BE5D2400022B795 /* OnLineFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OnLineFooterView.m; sourceTree = "<group>"; };
840ABECA1BE1C29F006E49C5 /* RankDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailViewController.h; sourceTree = "<group>"; };
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>"; };
8419EAD21BEDC98F002635ED /* HttpClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpClient.h; sourceTree = "<group>"; };
8419EAD31BEDC98F002635ED /* HttpClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HttpClient.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>"; };
841D24F61BEB473C0005CC9F /* CheckPicViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckPicViewController.h; sourceTree = "<group>"; };
841D24F71BEB473C0005CC9F /* CheckPicViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CheckPicViewController.m; sourceTree = "<group>"; };
841D24F91BEB75CA0005CC9F /* QuestionDetailFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionDetailFooterView.h; sourceTree = "<group>"; };
......@@ -190,6 +190,17 @@
84AD4F311BF443E700BFB37C /* InspectDetailHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectDetailHeaderView.m; sourceTree = "<group>"; };
84AD4F341BF45BEB00BFB37C /* InspectSortTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectSortTableCell.h; sourceTree = "<group>"; };
84AD4F351BF45BEB00BFB37C /* InspectSortTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectSortTableCell.m; sourceTree = "<group>"; };
84AD4F381BF4844600BFB37C /* RankDetailHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailHeaderView.h; sourceTree = "<group>"; };
84AD4F391BF4844600BFB37C /* RankDetailHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailHeaderView.m; sourceTree = "<group>"; };
84AD4F3B1BF4894D00BFB37C /* RankDetailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailView.h; sourceTree = "<group>"; };
84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailView.m; sourceTree = "<group>"; };
84AD4F3E1BF498A900BFB37C /* ranking.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = ranking.plist; sourceTree = "<group>"; };
84AD4F411BF4A66F00BFB37C /* WorkModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkModel.h; sourceTree = "<group>"; };
84AD4F421BF4A66F00BFB37C /* WorkModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WorkModel.m; sourceTree = "<group>"; };
84AD4F441BF4A9E800BFB37C /* RankHeadView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankHeadView.h; sourceTree = "<group>"; };
84AD4F451BF4A9E800BFB37C /* RankHeadView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankHeadView.m; sourceTree = "<group>"; };
84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankDetailTableCell.h; sourceTree = "<group>"; };
84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankDetailTableCell.m; sourceTree = "<group>"; };
84C582EA1BDDFB0400AF838D /* HomeFunctionCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeFunctionCell.h; sourceTree = "<group>"; };
84C582EB1BDDFB0400AF838D /* HomeFunctionCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeFunctionCell.m; sourceTree = "<group>"; };
84C957491BDB344900083584 /* UIBarButtonItem+Create.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIBarButtonItem+Create.h"; sourceTree = "<group>"; };
......@@ -651,6 +662,8 @@
848699AA1BDF810900859DFE /* RankDetail */ = {
isa = PBXGroup;
children = (
84AD4F401BF49FC100BFB37C /* Model */,
84AD4F371BF4842C00BFB37C /* View */,
848699AB1BDF810900859DFE /* Cell */,
848699AC1BDF810900859DFE /* ViewController */,
);
......@@ -660,10 +673,8 @@
848699AB1BDF810900859DFE /* Cell */ = {
isa = PBXGroup;
children = (
840ABECD1BE20A53006E49C5 /* RankShopDetialCell.h */,
840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */,
841BBCDC1BE49E18007A21BF /* RankWorkDetailCell.h */,
841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */,
84AD4F471BF4BC0600BFB37C /* RankDetailTableCell.h */,
84AD4F481BF4BC0600BFB37C /* RankDetailTableCell.m */,
);
path = Cell;
sourceTree = "<group>";
......@@ -735,6 +746,7 @@
84970DF91BD8DD8A00C1728A /* Assets.xcassets */,
84970DFB1BD8DD8A00C1728A /* LaunchScreen.storyboard */,
84970DFE1BD8DD8A00C1728A /* Info.plist */,
84AD4F3E1BF498A900BFB37C /* ranking.plist */,
84AD4F211BF42F8E00BFB37C /* classfiy.plist */,
84970DED1BD8DD8A00C1728A /* Supporting Files */,
);
......@@ -913,6 +925,28 @@
path = Cell;
sourceTree = "<group>";
};
84AD4F371BF4842C00BFB37C /* View */ = {
isa = PBXGroup;
children = (
84AD4F381BF4844600BFB37C /* RankDetailHeaderView.h */,
84AD4F391BF4844600BFB37C /* RankDetailHeaderView.m */,
84AD4F3B1BF4894D00BFB37C /* RankDetailView.h */,
84AD4F3C1BF4894D00BFB37C /* RankDetailView.m */,
84AD4F441BF4A9E800BFB37C /* RankHeadView.h */,
84AD4F451BF4A9E800BFB37C /* RankHeadView.m */,
);
path = View;
sourceTree = "<group>";
};
84AD4F401BF49FC100BFB37C /* Model */ = {
isa = PBXGroup;
children = (
84AD4F411BF4A66F00BFB37C /* WorkModel.h */,
84AD4F421BF4A66F00BFB37C /* WorkModel.m */,
);
path = Model;
sourceTree = "<group>";
};
84C582E91BDDFACD00AF838D /* Cell */ = {
isa = PBXGroup;
children = (
......@@ -1286,6 +1320,7 @@
buildActionMask = 2147483647;
files = (
84970DFD1BD8DD8A00C1728A /* LaunchScreen.storyboard in Resources */,
84AD4F3F1BF498A900BFB37C /* ranking.plist in Resources */,
84970DFA1BD8DD8A00C1728A /* Assets.xcassets in Resources */,
84AD4F221BF42F8E00BFB37C /* classfiy.plist in Resources */,
);
......@@ -1360,6 +1395,7 @@
84AD4F201BF425AC00BFB37C /* InspectDetailView.m in Sources */,
84C9574E1BDB344900083584 /* UIView+Frame.m in Sources */,
848699B01BDF810900859DFE /* InspectListCell.m in Sources */,
84AD4F3A1BF4844600BFB37C /* RankDetailHeaderView.m in Sources */,
8474C5951BE78AE1007DCF19 /* QuestionDetailViewController.m in Sources */,
84FD8A071BDA01C4006E442A /* ChartViewController.m in Sources */,
84970DEF1BD8DD8A00C1728A /* main.m in Sources */,
......@@ -1371,14 +1407,13 @@
84AD4F361BF45BEB00BFB37C /* InspectSortTableCell.m in Sources */,
84970E281BD8DEFE00C1728A /* AppDelegate.m in Sources */,
84AB20A51BE648EC00B66F13 /* PictureViewController.m in Sources */,
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */,
84F57C461BEC388A00DDEEB1 /* CommentView.m in Sources */,
84ED5DD81BF2E64300A1BB6D /* ScreenView.m in Sources */,
8474C5831BE751A2007DCF19 /* CommonFunc.m in Sources */,
84AD4F491BF4BC0600BFB37C /* RankDetailTableCell.m in Sources */,
848699B31BDF810900859DFE /* InspectTaskViewController.m in Sources */,
84AD4F321BF443E700BFB37C /* InspectDetailHeaderView.m in Sources */,
848699B11BDF810900859DFE /* MenuButton.m in Sources */,
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */,
84E420471BE88AE000689976 /* RootTabBarController.m in Sources */,
840826211BE5D2400022B795 /* OnLineFooterView.m in Sources */,
8487D80C1BF218F900E63E90 /* MenuView.m in Sources */,
......@@ -1393,6 +1428,8 @@
84CF0ED51BE9AC1400C855CE /* InspectSettleCell.m in Sources */,
84C957551BDB54D600083584 /* AnnounceViewController.m in Sources */,
84C9574D1BDB344900083584 /* UIBarButtonItem+Create.m in Sources */,
84AD4F3D1BF4894D00BFB37C /* RankDetailView.m in Sources */,
84AD4F431BF4A66F00BFB37C /* WorkModel.m in Sources */,
84970E391BD8E0B300C1728A /* LoginView.m in Sources */,
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */,
84CF0ED81BE9AC7E00C855CE /* InspectSettleViewController.m in Sources */,
......@@ -1400,6 +1437,7 @@
848699B61BDF812F00859DFE /* RankingListViewController.m in Sources */,
84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */,
84FD89F21BD9FC71006E442A /* HomeViewController.m in Sources */,
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */,
84E420411BE849FC00689976 /* QuestionDescribeCell.m in Sources */,
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */,
8442BA5C1BDB8FDB005E5657 /* MineTableHeaderView.m in Sources */,
......
{
"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 @@
bgButton.backgroundColor = [UIColor whiteColor];
bgButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
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];
[self addSubview:bgButton];
_bgButton = bgButton;
......
......@@ -106,7 +106,7 @@
TaskModel *task = taskGroup.classfiy[indexPath.row];
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.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
......@@ -122,7 +122,7 @@
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 45;
return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
......@@ -141,7 +141,6 @@
InspectHeaderView *headView = [InspectHeaderView headViewWithTableView:tableView];
headView.delegate = self;
headView.taskGroup = _taskData[section];
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
//
// RankDetailHeaderView.m
// redstar
//
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankDetailHeaderView.h"
@interface RankDetailHeaderView ()
@property (nonatomic, strong) UIImageView *arrowImageView1;
@property (nonatomic, strong) UIImageView *arrowImageView2;
@end
@implementation RankDetailHeaderView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)setup {
self.shopNameLabel.text = @"上海真北店";
[self.historyBtn setTitle:@"历史成绩" forState:UIControlStateNormal];
self.arrowImageView1.image = [UIImage imageNamed:@"arrow_right"];
self.rankDetailView.backgroundColor = [UIColor whiteColor];
self.titleLabel.text = @"口碑七大重点工作详情";
[self.showAllBtn setTitle:@"历史成绩" forState:UIControlStateNormal];
self.arrowImageView2.image = [UIImage imageNamed:@"arrow_right"];}
- (UILabel *)shopNameLabel
{
if (!_shopNameLabel) {
_shopNameLabel = [[UILabel alloc] init];
_shopNameLabel.translatesAutoresizingMaskIntoConstraints = NO;
_shopNameLabel.textColor = kDetailSection0TitleColor;
_shopNameLabel.font = [UIFont systemFontOfSize:18.0];
[self addSubview:_shopNameLabel];
// label
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_shopNameLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:titleTop];
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_shopNameLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:titleLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_shopNameLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.historyBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_shopNameLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:titleHeight];
}
return _shopNameLabel;
}
- (UIButton *)historyBtn
{
if (!_historyBtn) {
_historyBtn = [[UIButton alloc] init];
_historyBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
_historyBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_historyBtn setTitleColor:kDetailSection1TitleColor forState:UIControlStateNormal];
[self addSubview:_historyBtn];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_historyBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:historyTop];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_historyBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self addConstraint:historyWidth];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_historyBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.arrowImageView1 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_historyBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:historyHeight];
}
return _historyBtn;
}
- (UIImageView *)arrowImageView1
{
if (!_arrowImageView1) {
_arrowImageView1 = [[UIImageView alloc] init];
_arrowImageView1.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_arrowImageView1];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_arrowImageView1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:16];
[self addConstraint:historyTop];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView1 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7];
[self addConstraint:historyWidth];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_arrowImageView1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView1 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12];
[self addConstraint:historyHeight];
}
return _arrowImageView1;
}
- (RankDetailView *)rankDetailView
{
if (!_rankDetailView) {
_rankDetailView = [[RankDetailView alloc] init];
_rankDetailView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_rankDetailView];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_rankDetailView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.shopNameLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:historyTop];
NSLayoutConstraint *historyLeft = [NSLayoutConstraint constraintWithItem:_rankDetailView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:historyLeft];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_rankDetailView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_rankDetailView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:208];
[self addConstraint:historyHeight];
}
return _rankDetailView;
}
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.textColor = kDetailSection1TitleColor;
_titleLabel.font = [UIFont systemFontOfSize:17.0];
[self addSubview:_titleLabel];
// label
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.rankDetailView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:titleTop];
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:titleLeft];
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.showAllBtn attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:titleHeight];
}
return _titleLabel;
}
- (UIButton *)showAllBtn
{
if (!_showAllBtn) {
_showAllBtn = [[UIButton alloc] init];
_showAllBtn.translatesAutoresizingMaskIntoConstraints = NO;
_showAllBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
[_showAllBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[self addSubview:_showAllBtn];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_showAllBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.rankDetailView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:historyTop];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_showAllBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[self addConstraint:historyWidth];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_showAllBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.arrowImageView2 attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_showAllBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:historyHeight];
}
return _showAllBtn;
}
- (UIImageView *)arrowImageView2
{
if (!_arrowImageView2) {
_arrowImageView2 = [[UIImageView alloc] init];
_arrowImageView2.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_arrowImageView2];
// label
NSLayoutConstraint *historyTop = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.rankDetailView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:16];
[self addConstraint:historyTop];
NSLayoutConstraint *historyWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7];
[self addConstraint:historyWidth];
NSLayoutConstraint *historyRight = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:historyRight];
NSLayoutConstraint *historyHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView2 attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12];
[self addConstraint:historyHeight];
}
return _arrowImageView2;
}
@end
//
// RankShopDetialCell.h
// RankDetailView.h
// redstar
//
// Created by admin on 15/10/29.
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface RankShopDetialCell : UITableViewCell
@interface RankDetailView : UIView
@property (nonatomic, strong) UILabel *addressLabel; // 地址
@property (nonatomic, strong) UILabel *titleLabel; // 总标题
@property (nonatomic, strong) UILabel *reportTimeLabel; // 上报时间
......@@ -20,5 +20,4 @@
@property (nonatomic, strong) UILabel *gradeLabel; // 排名
@property (nonatomic, strong) UIImageView *gradeImageView; // 排名
@property (nonatomic, strong) UIScrollView *showScrollView; // 轮播图
@end
//
// RankShopDetialCell.m
// RankDetailView.m
// redstar
//
// Created by admin on 15/10/29.
// Created by admin on 15/11/12.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "RankShopDetialCell.h"
@interface RankShopDetialCell ()
#import "RankDetailView.h"
@interface RankDetailView ()
@property (nonatomic, strong) UIView *lineView1;
@property (nonatomic, strong) UIView *lineView2;
@property (nonatomic, strong) UIView *uplineView;
@property (nonatomic, strong) UIView *downlineView;
@end
@implementation RankShopDetialCell
@implementation RankDetailView
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
......@@ -42,6 +52,10 @@
self.scoreLabel.font = [UIFont systemFontOfSize:17.0];
self.gradeView.backgroundColor = [UIColor clearColor];
self.uplineView.backgroundColor = kSeparateLineColor;
self.downlineView.backgroundColor = kSeparateLineColor;
}
#pragma mark - Lazy Loading
......@@ -51,19 +65,19 @@
_addressLabel = [[UILabel alloc] init];
_addressLabel.translatesAutoresizingMaskIntoConstraints = NO;
_addressLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_addressLabel];
[self 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 *addressTop = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self 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 *addressLeft = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self 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 *addressRight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:addressRight];
NSLayoutConstraint *addressHeight = [NSLayoutConstraint constraintWithItem:_addressLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[self.contentView addConstraint:addressHeight];
[self addConstraint:addressHeight];
}
return _addressLabel;
......@@ -74,19 +88,19 @@
if (!_showScrollView) {
_showScrollView = [[UIScrollView alloc] init];
_showScrollView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_showScrollView];
[self 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];
[self 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 *showLeft = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self 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 *showRight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:showRight];
NSLayoutConstraint *showHeight = [NSLayoutConstraint constraintWithItem:_showScrollView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:70];
[self.contentView addConstraint:showHeight];
[self addConstraint:showHeight];
}
return _showScrollView;
}
......@@ -97,19 +111,19 @@
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.textColor = kDetailBigTitleColor;
[self.contentView addSubview:_titleLabel];
[self 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];
[self 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 *titleLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self 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 *titleRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:titleRight];
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
[self.contentView addConstraint:titleHeight];
[self addConstraint:titleHeight];
}
return _titleLabel;
}
......@@ -120,22 +134,22 @@
_reportTimeLabel = [[UILabel alloc] init];
_reportTimeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_reportTimeLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_reportTimeLabel];
[self 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];
[self 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 *reportLeft = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self 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];
[self addConstraint:reportRight];
NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_reportTimeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:reportHeight];
[self 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];
[self addConstraint:reportWidth];
}
return _reportTimeLabel;
}
......@@ -145,43 +159,43 @@
if (!_lineView1) {
_lineView1 = [[UIView alloc] init];
_lineView1.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_lineView1];
[self 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];
[self 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 *lineView1Bottom = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
[self 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];
[self addConstraint:lineView1Right];
NSLayoutConstraint *lineView1Width = [NSLayoutConstraint constraintWithItem:_lineView1 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self.contentView addConstraint:lineView1Width];
[self addConstraint:lineView1Width];
}
return _lineView1;
}
- (UILabel *)totalScoreLabel
- (UILabel *)totalScoreLabel
{
if (!_totalScoreLabel) {
_totalScoreLabel = [[UILabel alloc] init];
_totalScoreLabel.textAlignment = NSTextAlignmentCenter;
_totalScoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_totalScoreLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_totalScoreLabel];
[self 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];
[self 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];
[self addConstraint:reportRight];
NSLayoutConstraint *reportHeight = [NSLayoutConstraint constraintWithItem:_totalScoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:reportHeight];
[self 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];
[self addConstraint:reportWidth];
}
return _totalScoreLabel;
}
......@@ -191,19 +205,19 @@
if (!_lineView2) {
_lineView2 = [[UIView alloc] init];
_lineView2.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_lineView2];
[self 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];
[self 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 *lineView2Bottom = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
[self 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];
[self addConstraint:lineView2Right];
NSLayoutConstraint *lineView2Width = [NSLayoutConstraint constraintWithItem:_lineView2 attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self.contentView addConstraint:lineView2Width];
[self addConstraint:lineView2Width];
}
return _lineView2;
}
......@@ -215,16 +229,16 @@
_totalGradeLabel.textAlignment = NSTextAlignmentCenter;
_totalGradeLabel.translatesAutoresizingMaskIntoConstraints = NO;
_totalGradeLabel.textColor = kDetailSmallTitleColor;
[self.contentView addSubview:_totalGradeLabel];
[self 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];
[self 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 *totalGradeRight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:totalGradeRight];
NSLayoutConstraint *totalGradeHeight = [NSLayoutConstraint constraintWithItem:_totalGradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:20];
[self.contentView addConstraint:totalGradeHeight];
[self addConstraint:totalGradeHeight];
}
return _totalGradeLabel;
}
......@@ -235,19 +249,19 @@
_timeLabel = [[UILabel alloc] init];
_timeLabel.textColor = kDetailBigTitleColor;
_timeLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_timeLabel];
[self addSubview:_timeLabel];
NSLayoutConstraint *timeTop = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_reportTimeLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:timeTop];
[self 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 *timeLeft = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self 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];
[self addConstraint:timeRight];
NSLayoutConstraint *timeHeight = [NSLayoutConstraint constraintWithItem:_timeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:timeHeight];
[self addConstraint:timeHeight];
}
return _timeLabel;
}
......@@ -259,19 +273,19 @@
_scoreLabel.translatesAutoresizingMaskIntoConstraints = NO;
_scoreLabel.textColor = kNavigationBarColor;
_scoreLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:_scoreLabel];
[self addSubview:_scoreLabel];
NSLayoutConstraint *scoreTop = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreTop];
[self 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];
[self addConstraint:scoreRight];
NSLayoutConstraint *scoreHeight = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30];
[self.contentView addConstraint:scoreHeight];
[self addConstraint:scoreHeight];
NSLayoutConstraint *scoreWidth = [NSLayoutConstraint constraintWithItem:_scoreLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:_totalScoreLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self.contentView addConstraint:scoreWidth];
[self addConstraint:scoreWidth];
}
return _scoreLabel;
......@@ -282,20 +296,20 @@
if (!_gradeView) {
_gradeView = [[UIView alloc] init];
_gradeView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_gradeView];
[self 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];
[self addConstraint:totalGradeTop];
NSLayoutConstraint *totalGradeLeft = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_lineView2 attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:totalGradeLeft];
[self 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 *totalGradeRight = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self 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];
NSLayoutConstraint *totalGradeBottom = [NSLayoutConstraint constraintWithItem:_gradeView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:totalGradeBottom];
}
return _gradeView;
}
......@@ -347,11 +361,49 @@
return _gradeImageView;
}
- (UIView *)uplineView
{
if (!_uplineView) {
_uplineView = [[UIView alloc] init];
_uplineView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_uplineView];
NSLayoutConstraint *lineView1Top = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:lineView1Top];
NSLayoutConstraint *lineView1Height = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self addConstraint:lineView1Height];
NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:lineView1Right];
NSLayoutConstraint *lineView1Left = [NSLayoutConstraint constraintWithItem:_uplineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:lineView1Left];;
}
return _uplineView;
}
- (UIView *)downlineView
{
if (!_downlineView) {
_downlineView = [[UIView alloc] init];
_downlineView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_downlineView];
NSLayoutConstraint *lineView1Bottom = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:lineView1Bottom];
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
NSLayoutConstraint *lineView1Height = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:1];
[self addConstraint:lineView1Height];
// Configure the view for the selected state
NSLayoutConstraint *lineView1Right = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:lineView1Right];
NSLayoutConstraint *lineView1Left = [NSLayoutConstraint constraintWithItem:_downlineView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:lineView1Left];;
}
return _downlineView;
}
@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 @@
@interface RankDetailViewController : UIViewController
@property (nonatomic, assign) NSInteger indexRow;
@end
......@@ -7,15 +7,21 @@
//
#import "RankDetailViewController.h"
#import "RankShopDetialCell.h"
#import "RankWorkDetailCell.h"
#import "RankDetailTableCell.h"
#import "RankDetailHeaderView.h"
#define kRankDetailFirstCell @"RankShopDetialCell"
#define kRankDetailSecondCell @"RankWorkDetailCell"
#import "RankHeadView.h"
#import "WorkModel.h"
@interface RankDetailViewController () <UITableViewDataSource, UITableViewDelegate>
#define kRankDetailCell @"RankDetailTableCell"
@interface RankDetailViewController () <UITableViewDataSource, UITableViewDelegate, RankHeadViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) RankDetailHeaderView *rankDetailHeaderView;
@property (nonatomic, strong) NSArray *workData;
@property (nonatomic, strong) NSArray *test1Array;
@property (nonatomic, strong) NSArray *test2Array;
@property (nonatomic, strong) NSArray *test3Array;
......@@ -52,78 +58,52 @@
#pragma mark - Private Methods
- (void)addTableView {
NSURL *url = [[NSBundle mainBundle] URLForResource:@"ranking.plist" withExtension:nil];
NSArray *tempArray = [NSArray arrayWithContentsOfURL:url];
NSMutableArray *workArray = [NSMutableArray array];
for (NSDictionary *dict in tempArray) {
WorkModel *work = [WorkModel workModelWithDict:dict];
[workArray addObject:work];
}
_workData = workArray;
self.tableView.tableHeaderView = self.rankDetailHeaderView;
// 注册cell
[self.tableView registerClass:[RankShopDetialCell class] forCellReuseIdentifier:kRankDetailFirstCell];
[self.tableView registerClass:[RankWorkDetailCell class] forCellReuseIdentifier:kRankDetailSecondCell];
[self.tableView registerClass:[RankDetailTableCell class] forCellReuseIdentifier:kRankDetailCell];
}
#pragma mark - UITableView DataSource/Delegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
return _workData.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) {
return 1;
} else {
return 5;
}
WorkModel *work = _workData[section];
NSInteger count = work.isOpened ? work.Info.count : 0;
return count;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
RankShopDetialCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailFirstCell];
RankDetailTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kRankDetailCell];
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 = [[RankDetailTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kRankDetailCell];
}
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];
WorkModel *workModel = _workData[indexPath.section];
NSDictionary *dict = workModel.Info[indexPath.row];
[cell.mainTitleBtn setTitle:[NSString stringWithFormat:@"%d、%@", (int)(indexPath.row + 1),dict[@"titles"]] forState:UIControlStateNormal];
cell.scoreLabel.text = [NSString stringWithFormat:@"%@分", dict[@"scroes"]];
return cell;
}
}
......@@ -136,16 +116,13 @@
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
return 208;
}
return 50;
return 45;
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 45;
return 50;
}
// foot高度
......@@ -157,79 +134,19 @@
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.backgroundColor = kMineBackGroundColor;
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[sectionView addSubview:titleLabel];
UIButton *clickButton= [[UIButton alloc] init];
clickButton.translatesAutoresizingMaskIntoConstraints = NO;
clickButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[sectionView addSubview:clickButton];
UIImageView *arrowImageView = [[UIImageView alloc] init];
arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
arrowImageView.image = [UIImage imageNamed:@"arrow_right"];
[sectionView addSubview:arrowImageView];
if (section == 0) {
titleLabel.text = @"上海真北店";
titleLabel.textColor = kDetailSection0TitleColor;
titleLabel.font = [UIFont systemFontOfSize:18.0];
[clickButton setTitleColor:kDetailSection1TitleColor forState:UIControlStateNormal];
[clickButton setTitle:@"历史成绩" forState:UIControlStateNormal];
} else {
titleLabel.text = @"口碑七大重点工作详情";
titleLabel.textColor = kDetailSection1TitleColor;
titleLabel.font = [UIFont systemFontOfSize:17.0];
[clickButton setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[clickButton setTitle:@"展开全部" forState:UIControlStateNormal];
}
// label
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[sectionView addConstraint:titleTop];
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:170];
[sectionView addConstraint:titleWidth];
RankHeadView *headView = [RankHeadView headViewWithTableView:tableView];
headView.delegate = self;
headView.work = _workData[section];
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:titleBottom];
// button
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:-3];
[sectionView addConstraint:clickRight];
NSLayoutConstraint *clickWidth = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60];
[sectionView addConstraint:clickWidth];
NSLayoutConstraint *clickBottom = [NSLayoutConstraint constraintWithItem:clickButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:clickBottom];
// button
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:7];
[sectionView addConstraint:arrowWidth];
return headView;
}
NSLayoutConstraint *arrowBottom = [NSLayoutConstraint constraintWithItem:arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:13];
[sectionView addConstraint:arrowBottom];
return sectionView;
- (void)clickRankHeadView
{
[self.tableView reloadData];
}
#pragma mark - lazy Laoding
- (UITableView *)tableView
{
......@@ -258,6 +175,33 @@
}
- (RankDetailHeaderView *)rankDetailHeaderView
{
if (!_rankDetailHeaderView) {
_rankDetailHeaderView = [[RankDetailHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 298)];
_rankDetailHeaderView.rankDetailView.addressLabel.text = @"上海市真北路1108号";
_rankDetailHeaderView.rankDetailView.titleLabel.text = @"2015年8月口碑巡检";
_rankDetailHeaderView.rankDetailView.reportTimeLabel.text = @"上报时间";
_rankDetailHeaderView.rankDetailView.totalScoreLabel.text = @"总评分";
_rankDetailHeaderView.rankDetailView.totalGradeLabel.text = @"总排名";
_rankDetailHeaderView.rankDetailView.timeLabel.text = @"2015-08-15";
_rankDetailHeaderView.rankDetailView.scoreLabel.text = @"100";
if (self.indexRow < 3) {
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(_indexRow + 1)];
_rankDetailHeaderView.rankDetailView.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)];
[_rankDetailHeaderView.rankDetailView.gradeLabel setAttributedText:rankAttr];
}
}
return _rankDetailHeaderView;
}
/*
#pragma mark - Navigation
......
<?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