Commit 2c2646fb authored by admin's avatar admin

首页完成 评论接口完成

parent de4938f8
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_00@2x.png", "filename" : "task_online@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_00@3x.png", "filename" : "task_online@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_03@2x.png", "filename" : "praise_report@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_03@3x.png", "filename" : "praise_report@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "praise_standard@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "praise_standard@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_02@2x.png", "filename" : "praise_image@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_02@3x.png", "filename" : "praise_image@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "question_problem@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "question_problem@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_01@2x.png", "filename" : "excellent_case@2x.png",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"idiom" : "universal", "idiom" : "universal",
"filename" : "task_01@3x.png", "filename" : "excellent_case@3x.png",
"scale" : "3x" "scale" : "3x"
} }
], ],
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "task_04@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "task_04@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "task_05@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "task_05@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#define kScreenWidth [UIScreen mainScreen].bounds.size.width #define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height #define kScreenHeight [UIScreen mainScreen].bounds.size.height
#define kPushTag 2354924
// ----- Login ----- // ----- Login -----
......
...@@ -153,6 +153,9 @@ ...@@ -153,6 +153,9 @@
NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45]; NSLayoutConstraint *titleImageHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self.contentView addConstraint:titleImageHeight]; [self.contentView addConstraint:titleImageHeight];
NSLayoutConstraint *titleImageBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:titleImageBottom];
} }
return _dateLabel; return _dateLabel;
} }
......
...@@ -194,6 +194,10 @@ ...@@ -194,6 +194,10 @@
// 高度 // 高度
NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:16]; NSLayoutConstraint *stateHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:16];
[self.contentView addConstraint:stateHeight]; [self.contentView addConstraint:stateHeight];
// 高度
NSLayoutConstraint *stateBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:stateBottom];
} }
return _dateLabel; return _dateLabel;
} }
......
...@@ -281,6 +281,9 @@ ...@@ -281,6 +281,9 @@
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25]; NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:overDateHeight]; [self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_allView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:overDateBottom];
} }
return _allView; return _allView;
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#import "RankListModel.h" #import "RankListModel.h"
#define kPushTag 2354924
@interface RankListHeaderView () @interface RankListHeaderView ()
{ {
UIView *_bgView; UIView *_bgView;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#define kRankingCell @"RankingTableViewCell" #define kRankingCell @"RankingTableViewCell"
#define kShopNameBtnTag 15000 #define kShopNameBtnTag 15000
#define kPushTag 2354924
@interface RankingListViewController () <UITableViewDataSource, UITableViewDelegate, RankListHeaderDelegate> @interface RankingListViewController () <UITableViewDataSource, UITableViewDelegate, RankListHeaderDelegate>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
......
...@@ -30,16 +30,17 @@ ...@@ -30,16 +30,17 @@
CGFloat btnW = self.width; CGFloat btnW = self.width;
CGFloat btnH = self.height; CGFloat btnH = self.height;
self.imageView.frame = CGRectMake((btnW - 45) / 2 , 13, 45, 45); CGFloat imageH = btnH * 0.7;
self.imageView.frame = CGRectMake(0, 7, btnW, imageH);
CGFloat titleH = btnH - 55; CGFloat titleH = btnH - imageH;
CGFloat titleY = 61; CGFloat titleY = imageH - 5;
self.titleLabel.frame = CGRectMake(0, titleY, btnW, titleH); self.titleLabel.frame = CGRectMake(0, titleY, btnW, titleH);
// // 设置badgeView尺寸 // // 设置badgeView尺寸
// self.badgeView.x = self.width - self.badgeView.width - HMMargin; // self.badgeView.x = self.width - self.badgeView.width - HMMargin;
// //
// self.badgeView.y = 0; // self.badgeView.y = 0;
} }
......
...@@ -85,6 +85,9 @@ ...@@ -85,6 +85,9 @@
NSLayoutConstraint *gradeBottom = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; NSLayoutConstraint *gradeBottom = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:gradeBottom]; [self.contentView addConstraint:gradeBottom];
NSLayoutConstraint *shoppingHheight = [NSLayoutConstraint constraintWithItem:gradeLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.2 constant:30];
[self.contentView addConstraint:shoppingHheight];
} }
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
- (UIScrollView *)scrollView - (UIScrollView *)scrollView
{ {
if (!_scrollView) { if (!_scrollView) {
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 86)]; _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, 120)];
_scrollView.bounces = NO; _scrollView.bounces = NO;
_scrollView.backgroundColor = [UIColor whiteColor]; _scrollView.backgroundColor = [UIColor whiteColor];
_scrollView.pagingEnabled = YES; _scrollView.pagingEnabled = YES;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#import "HomeViewController.h" #import "HomeViewController.h"
#import "HomeHeaderView.h" #import "HomeHeaderView.h"
#import "RankListHeaderView.h"
#import "InspectListViewController.h" #import "InspectListViewController.h"
#import "RankingListViewController.h" #import "RankingListViewController.h"
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#define kHomeRankingListCell @"homeRankingListsCell" #define kHomeRankingListCell @"homeRankingListsCell"
#import "RankDetailViewController.h" #import "RankDetailViewController.h"
#import "RankListModel.h" #import "RankListModel.h"
#import "RankCommentCell.h"
#import "QuestionListTableCell.h" #import "QuestionListTableCell.h"
#define kHomeQuestionListTableCell @"homeQuestionListTableCell" #define kHomeQuestionListTableCell @"homeQuestionListTableCell"
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
#import "HttpClient.h" #import "HttpClient.h"
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
@interface HomeViewController () <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, UITextFieldDelegate> @interface HomeViewController () <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate, UITextFieldDelegate, RankListHeaderDelegate>
@property (nonatomic, strong) UIImageView *bgImageView; // 背景 @property (nonatomic, strong) UIImageView *bgImageView; // 背景
@property (nonatomic, strong) UITextField *searchTextField; // 搜索框 @property (nonatomic, strong) UITextField *searchTextField; // 搜索框
@property (nonatomic, strong) UILabel *shopnameLabel; // 店名 @property (nonatomic, strong) UILabel *shopnameLabel; // 店名
...@@ -63,18 +64,13 @@ ...@@ -63,18 +64,13 @@
@property (nonatomic, strong) NSArray *test3Array; // section标题 @property (nonatomic, strong) NSArray *test3Array; // section标题
@property (nonatomic, strong) NSArray *test4Array;
@property (nonatomic, strong) NSArray *test5Array;
@property (nonatomic, strong) NSArray *test6Array;
@property (nonatomic, strong) NSArray *test7Array;
@property (nonatomic, strong) NSArray *test8Array;
@property (nonatomic, strong) NSArray *test9Array;
// rank cell // rank cell
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes; @property (nonatomic, strong) NSMutableDictionary *selectedIndexes;
@property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *allQuestionArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识 @property (nonatomic, strong) NSMutableArray *taskListDataArray; // 问题与知识
@property (nonatomic, strong) NSMutableArray *allRankListArray; @property (nonatomic, strong) NSMutableArray *allRankListArray;
@property (nonatomic, strong) NSArray *rankData;
@end @end
@implementation HomeViewController @implementation HomeViewController
...@@ -100,12 +96,7 @@ ...@@ -100,12 +96,7 @@
self.test2Array = [NSArray arrayWithObjects:@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。",@"变成商场服务提升的契机,变成商场服务提升的契机。",@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。", nil]; self.test2Array = [NSArray arrayWithObjects:@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。",@"变成商场服务提升的契机,变成商场服务提升的契机。",@"把第一次客户投诉变成商场服务提升的契机,变成商场服务提升的契机。", nil];
self.test3Array = [NSArray arrayWithObjects:@"2015-08-26",@"2015-08-09",@"2015-07-31", nil]; self.test3Array = [NSArray arrayWithObjects:@"2015-08-26",@"2015-08-09",@"2015-07-31", nil];
self.test7Array = [NSArray arrayWithObjects:@"2015年9月口碑巡检",@"2015年9月卫生专项巡检",@"2015年9月真北店安全临时巡检",@"2015年10月卫生专项巡检",@"2015年10月设备安全巡检", nil];
self.test8Array = [NSArray arrayWithObjects:@"2015-09-01 10:28:52",@"2015-09-08 12:47:32",@"2015-10-21 07:58:22",@"2015-10-09 19:08:52",@"2015-09-01 14:19:52", nil];
self.test9Array = [NSArray arrayWithObjects:@"2015-09-03",@"2015-09-15",@"2015-10-22",@"2015-11-02",@"2015-11-05", nil];
self.test4Array = [NSArray arrayWithObjects:@"2",@"3",@"1",@"2",@"1", nil];
self.test5Array = [NSArray arrayWithObjects:@(5),@(12),@(0),@(8),@(20), nil];
self.test6Array = [NSArray arrayWithObjects:@(16),@(25),@(20),@(100),@(20), nil];
[self setupNav]; [self setupNav];
[self setupTableView]; [self setupTableView];
...@@ -154,15 +145,18 @@ ...@@ -154,15 +145,18 @@
@"pageNumber":@(0), @"pageNumber":@(0),
@"pageSize":@(3) @"pageSize":@(3)
}; };
__block HomeViewController *weakSelf = self;
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) { [httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response); NSLog(@"口碑排名response = %@", response);
NSDictionary *dataDict = response[@"data"]; NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"]; NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tgArray = [NSMutableArray array];
for (NSDictionary *ListDict in dataArray) { for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict]; RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[weakSelf.allRankListArray addObject:rankList]; [tgArray addObject:rankList];
} }
_rankData = tgArray;
[self.tableView reloadData]; [self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
...@@ -254,16 +248,16 @@ ...@@ -254,16 +248,16 @@
- (void)setupTableView - (void)setupTableView
{ {
self.headView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 115)]; self.headView = [[HomeHeaderView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 149)];
self.headView.scrollView.contentSize = CGSizeMake(2 * kScreenWidth, 85); self.headView.scrollView.contentSize = CGSizeMake(2 * kScreenWidth, 120);
CGFloat itemW = kScreenWidth / 4; CGFloat itemW = kScreenWidth / 3;
CGFloat itemH = self.headView.scrollView.frame.size.height; CGFloat itemH = self.headView.scrollView.frame.size.height;
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
HomeCellItem *item = [[HomeCellItem alloc] init]; HomeCellItem *item = [[HomeCellItem alloc] init];
item.frame = CGRectMake(i * itemW, 0, itemW, itemH); item.frame = CGRectMake(i * itemW, 0, itemW, itemH);
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"task_0%d", i]]; UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"task_00%d", i]];
[item setImage:image forState:UIControlStateNormal]; [item setImage:image forState:UIControlStateNormal];
[item setTitleColor:kPictureCellDetailsColor forState:UIControlStateNormal]; [item setTitleColor:kPictureCellDetailsColor forState:UIControlStateNormal];
[item setTitle:[NSString stringWithFormat:@"%@", self.btnTitleArray[i]] forState:UIControlStateNormal]; [item setTitle:[NSString stringWithFormat:@"%@", self.btnTitleArray[i]] forState:UIControlStateNormal];
...@@ -452,7 +446,7 @@ ...@@ -452,7 +446,7 @@
#pragma mark - TableView Delegate/DataSource #pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
return _titleArray.count; return _titleArray.count + _rankData.count;
} }
...@@ -461,11 +455,15 @@ ...@@ -461,11 +455,15 @@
if (section == 0) { if (section == 0) {
return 2; return 2;
} else if (section == 1) { } else if (section == 1) {
return _allRankListArray.count + 1; return 1;
} else if (section == 2) { } else if (section == 2 + _rankData.count) {
return _allQuestionArray.count; return _allQuestionArray.count;
} else{ } else if (section == 3 + _rankData.count) {
return _taskListDataArray.count; return _taskListDataArray.count;
} else {
RankListModel *rankList = _rankData[section - 2];
NSInteger count = rankList.isOpened ? rankList.comments.count: 0;
return count;
} }
} }
...@@ -490,31 +488,14 @@ ...@@ -490,31 +488,14 @@
return cell; return cell;
} else if (indexPath.section == 1) { } else if (indexPath.section == 1) {
// 口碑巡检
if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell]; HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) { if (!cell) {
cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell]; cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell];
} }
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell; return cell;
} else { } else if (indexPath.section == 2 + _rankData.count) {
RankingListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
}
RankListModel *rankList = _allRankListArray[indexPath.row - 1];
cell.rankList = rankList;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.scoreState = ScoreStateHigh;
NSString *imageName = [NSString stringWithFormat:@"medal_0%ld", (long)(indexPath.row)];
cell.gradeImageView.image = [UIImage imageNamed:imageName]; // 添加点击事件
[cell.shopNameButton addTarget:self action:@selector(loadMoreInfo:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
} else if (indexPath.section == 2) {
// 问题与知识 // 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell]; QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) { if (!cell) {
...@@ -525,7 +506,7 @@ ...@@ -525,7 +506,7 @@
cell.question = question; cell.question = question;
return cell; return cell;
} else { } else if (indexPath.section == 3 + _rankData.count) {
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell]; InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
if (!cell) { if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell]; cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
...@@ -538,6 +519,15 @@ ...@@ -538,6 +519,15 @@
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile]; image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image; cell.alreadyView.image = image;
return cell; return cell;
} else {
RankCommentCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
if (!cell) {
cell = [[RankCommentCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
}
RankListModel *rankListModel = _rankData[indexPath.section];
RankCommentModel *commentModel = rankListModel.comments[indexPath.row];
cell.rankComment = commentModel;
return cell;
} }
} }
...@@ -551,23 +541,15 @@ ...@@ -551,23 +541,15 @@
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]]; [nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil]; [self presentViewController:nav animated:YES completion:nil];
} else if (indexPath.section == 1) { } else if (indexPath.section == 1) {
if (indexPath.row != 0) {
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init]; } else if (indexPath.section == 2 + _rankData.count) {
RankListModel *rankModel = _allRankListArray[indexPath.row - 1];
rankDetailVC.indexRow = indexPath.row - 1;
rankDetailVC.uuid = rankModel.uuid;
rankDetailVC.store_uuid = rankModel.store_uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:rankDetailVC animated:YES];
}
} else if (indexPath.section == 2) {
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init]; QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
QuestionModel *question = self.allQuestionArray[indexPath.row]; QuestionModel *question = self.allQuestionArray[indexPath.row];
questionDetailVC.questionUuid = question.uuid; questionDetailVC.questionUuid = question.uuid;
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:questionDetailVC animated:YES]; [self.navigationController pushViewController:questionDetailVC animated:YES];
} else { } else if (indexPath.section == 3 + _rankData.count) {
InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init]; InspectTaskViewController *inspectTaskVC = [[InspectTaskViewController alloc] init];
TaskListModel *taskList = self.taskListDataArray[indexPath.row]; TaskListModel *taskList = self.taskListDataArray[indexPath.row];
...@@ -577,48 +559,72 @@ ...@@ -577,48 +559,72 @@
self.hidesBottomBarWhenPushed = YES; self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:inspectTaskVC animated:YES]; [self.navigationController pushViewController:inspectTaskVC animated:YES];
} else {
RankListModel *rankList = _rankData[indexPath.section];
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
rankDetailVC.indexRow = indexPath.section;
rankDetailVC.uuid = rankList.uuid;
rankDetailVC.store_uuid = rankList.store_uuid;
rankDetailVC.storeAddress = rankList.storeAddress;
rankDetailVC.storePictures = rankList.storePictures;
[self.navigationController pushViewController:rankDetailVC animated:YES];
} }
} }
// cell的高度 // cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath //- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{ //{
if (indexPath.section == 0) { // if (indexPath.section == 0) {
return 123; // return 123;
} else if (indexPath.section == 1) { // } else if (indexPath.section == 1) {
if (indexPath.row == 0) { // return 40;
return 40; // } else if (indexPath.section == 2 + _rankData.count) {
} else { // return 120;
if([self cellIsSelected:indexPath]) { // } else if (indexPath.section == 3 + _rankData.count){
return 108; // return 145;
} // } else {
return 50; // return 50;
} // }
} else if (indexPath.section == 2) { //}
return 120;
} else {
return 145;
}
}
// section高度 // section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{ {
if (section == 0) {
return 36;
} else if (section == 1) {
return 36;
} else if (section == 2 + _rankData.count) {
return 36;
} else if (section == 3 + _rankData.count){
return 36; return 36;
} else {
return 50;
}
} }
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{ {
if (section == 0) {
return 10; return 10;
} else if (section == 1) {
return CGFLOAT_MIN;
} else if (section == 1 + _rankData.count) {
return 10;
} else if (section == 2 + _rankData.count) {
return 10;
} else if (section == 3 + _rankData.count){
return 10;
} else {
return CGFLOAT_MIN;
}
} }
// 自定义section // 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{ {
if (section == 0 || section == 1 || section == 2 + _rankData.count || section == 3 + _rankData.count) {
// 创建sectionView // 创建sectionView
UIView *sectionView = [[UIView alloc] init]; UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES; sectionView.userInteractionEnabled = YES;
...@@ -646,7 +652,16 @@ ...@@ -646,7 +652,16 @@
titleLabel.translatesAutoresizingMaskIntoConstraints = NO; titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textColor = kPictureCellDetailsColor; titleLabel.textColor = kPictureCellDetailsColor;
titleLabel.font = [UIFont systemFontOfSize:17.0]; titleLabel.font = [UIFont systemFontOfSize:17.0];
if (section == 0) {
titleLabel.text = _titleArray[section];
} else if (section == 1) {
titleLabel.text = _titleArray[section]; titleLabel.text = _titleArray[section];
} else if (section == 2 + _rankData.count) {
titleLabel.text = _titleArray[section - _rankData.count];
} else {
titleLabel.text = _titleArray[section - _rankData.count];
}
[sectionView addSubview:titleLabel]; [sectionView addSubview:titleLabel];
...@@ -710,6 +725,28 @@ ...@@ -710,6 +725,28 @@
return sectionView; return sectionView;
} else {
RankListHeaderView *headerView = [RankListHeaderView headViewWithTableView:tableView section:section];
headerView.delegate = self;
[headerView.pushButton addTarget:self action:@selector(pushclick:) forControlEvents:UIControlEventTouchUpInside];
headerView.rankListModel = _rankData[section-2];
return headerView;
}
}
- (void)pushclick:(UIButton *)sender
{
NSInteger section = sender.tag - kPushTag;
RankListModel *rankList = _rankData[section-2];
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
rankDetailVC.indexRow = section;
rankDetailVC.uuid = rankList.uuid;
rankDetailVC.store_uuid = rankList.store_uuid;
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:rankDetailVC animated:YES];
} }
#pragma mark - lazy loading #pragma mark - lazy loading
...@@ -835,10 +872,12 @@ ...@@ -835,10 +872,12 @@
_tableView.dataSource = self; _tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO; _tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO; _tableView.showsHorizontalScrollIndicator = NO;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 300.0;
_tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 40)]; _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 40)];
[_tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kHomePictureListCell]; [_tableView registerClass:[PictureTableCell class] forCellReuseIdentifier:kHomePictureListCell];
[_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell]; [_tableView registerClass:[HomeTitleTableCell class] forCellReuseIdentifier:kHomeTitleTableCell];
[_tableView registerClass:[RankingListCell class] forCellReuseIdentifier:kHomeRankingListCell]; [_tableView registerClass:[RankCommentCell class] forCellReuseIdentifier:kHomeRankingListCell];
[_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell]; [_tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kHomeQuestionListTableCell];
[self.view addSubview:_tableView]; [self.view addSubview:_tableView];
...@@ -960,4 +999,9 @@ ...@@ -960,4 +999,9 @@
return NO; return NO;
} }
- (void)clickHeadView
{
[_tableView reloadData];
}
@end @end
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