1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// PatrolExamQuestionTableViewCell.m
// patrol
//
// Created by Javen on 2017/3/1.
// Copyright © 2017年 上海勾芒科技有限公司. All rights reserved.
//
#import "PatrolExamQuestionTableViewCell.h"
#import "PatrolExamCellViewModel.h"
@implementation PatrolExamQuestionTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
}
- (void)actionNotiAnswerChanged:(NSNotification *)noti {
PatrolExamCellViewModel *cellModel = noti.object;
if ([cellModel.question.uuid isEqualToString:self.cellModel.question.uuid]) {
if (cellModel.answer != nil) {
[self bluePin];
if (cellModel.cellType == ExamCellTypeStar) {
if ([cellModel.answer.score isEqualToNumber:@0]) {
[self redPin];
}else{
[self bluePin];
}
}
}else{
[self redPin];
}
}
}
- (void)redPin {
self.imgPin.image = TCImage(@"patrol_exam_red_pin");
}
- (void)bluePin {
self.imgPin.image = TCImage(@"patrol_exam_blue_pin");
}
- (void)setCellModel:(PatrolExamCellViewModel *)cellModel {
[super setCellModel:cellModel];
NSString *title = nil;
if (cellModel.question.titleNumber) {
title = [NSString stringWithFormat:@"%@ %@",cellModel.question.titleNumber,cellModel.question.title];
}else {
title = cellModel.question.title;
}
self.labelTitle.text = title;
self.labelStandScore.text = [NSString stringWithFormat:@"%@%@", cellModel.question.standScore,@"分"];
self.labelStandScore.hidden = cellModel.question.standScore == nil;
ZJPatrolDetail_results_answers *answer = self.cellModel.answer;
if (answer) {
[self bluePin];
}else{
[self redPin];
}
}
@end