Commit eabddaa1 authored by admin's avatar admin

bug修复

parent ce9164a1
...@@ -456,10 +456,12 @@ ...@@ -456,10 +456,12 @@
#pragma mark - TableView Delegate/DataSource #pragma mark - TableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{ {
if (_titleArray.count == 6) { if (_titleArray.count == 1) {
return 3;
} else {
return _titleArray.count; return _titleArray.count;
} else if (_titleArray.count == 5){
return 2;
} else {
return 3;
} }
} }
...@@ -467,6 +469,14 @@ ...@@ -467,6 +469,14 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ {
if (_titleArray.count == 5) {
if (section == 0) {
return _taskListDataArray.count;
} else {
return _allQuestionArray.count;
}
} else {
if (section == 0) { if (section == 0) {
return _taskListDataArray.count; return _taskListDataArray.count;
...@@ -477,68 +487,96 @@ ...@@ -477,68 +487,96 @@
return _allQuestionArray.count; return _allQuestionArray.count;
} }
}
} }
// cell显示的内容
// cell显示的内容 // cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{ {
if (_titleArray.count == 5) {
if (indexPath.section == 0) {
if (indexPath.section == 0) { 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]; }
TaskListModel *taskList = _taskListDataArray[indexPath.row];
cell.taskList = taskList;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} else {
// 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) {
cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeQuestionListTableCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
QuestionModel *question = _allQuestionArray[indexPath.row];
cell.question = question;
return cell;
} }
TaskListModel *taskList = _taskListDataArray[indexPath.row]; } else {
cell.taskList = taskList; if (indexPath.section == 0) {
cell.selectionStyle = UITableViewCellSelectionStyleNone; InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeInspectListCell];
cell.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell;
} else if (indexPath.section == 1) {
if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) { if (!cell) {
cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell]; cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeInspectListCell];
} }
TaskListModel *taskList = _taskListDataArray[indexPath.row];
cell.taskList = taskList;
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.allView.backgroundColor = kProgressViewAllBackColor;
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
cell.alreadyView.image = image;
return cell; return cell;
} else if (indexPath.section == 1) {
if (indexPath.row == 0) {
HomeTitleTableCell *cell=[tableView dequeueReusableCellWithIdentifier:kHomeTitleTableCell];
if (!cell) {
cell = [[HomeTitleTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeTitleTableCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
RankingListCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell];
}
cell.rankList = _allRankListArray[indexPath.row - 1];
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", (int)indexPath.row]];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
} else { } else {
RankingListCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeRankingListCell];
// 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) { if (!cell) {
cell = [[RankingListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeRankingListCell]; cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeQuestionListTableCell];
} }
cell.rankList = _allRankListArray[indexPath.row - 1];
cell.gradeImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"medal_0%d", (int)indexPath.row]];
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
QuestionModel *question = _allQuestionArray[indexPath.row];
cell.question = question;
return cell; return cell;
} }
} else {
// 问题与知识
QuestionListTableCell *cell = [tableView dequeueReusableCellWithIdentifier:kHomeQuestionListTableCell];
if (!cell) {
cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kHomeQuestionListTableCell];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
QuestionModel *question = _allQuestionArray[indexPath.row];
cell.question = question;
return cell;
} }
} }
// if ([title isEqualToString:@"口碑排名"]) { // if ([title isEqualToString:@"口碑排名"]) {
......
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