123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // PracticeExamCell.m
- // jiaPei
- //
- // Created by 张嵘 on 2019/8/27.
- // Copyright © 2019 JCZ. All rights reserved.
- //
- #import "PracticeExamCell.h"
- #import "QuestionModel.h"
- @interface PracticeExamCell()
- @property(nonatomic,strong)UIImageView *imageV;
- @property(nonatomic,strong)UILabel *quesLab;
- @end
- @implementation PracticeExamCell
- + (instancetype)cellWithTableView:(UITableView *)tablView;
- {
- static NSString *ID = @"PracticeExamCell";
- PracticeExamCell *cell = [tablView dequeueReusableCellWithIdentifier:ID];
- if (cell == nil) {
- cell = [[PracticeExamCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
- }
- return cell;
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self creatUI];
-
- }
- return self;
- }
- -(void)creatUI{
- self.backgroundColor = [UIColor clearColor];
- [self.contentView addSubview:self.imageV];
- [self.contentView addSubview:self.quesLab];
- [_quesLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(20);
- make.left.mas_equalTo(50);
- make.right.bottom.mas_equalTo(-20);
-
- }];
- WeakSelf(weakSelf)
- [_imageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.centerY.equalTo(weakSelf.quesLab.mas_centerY);
- make.width.height.mas_equalTo(25);
- }];
- }
- -(UIImageView *)imageV{
- if (!_imageV) {
- _imageV = [[UIImageView alloc]init];
- }
- return _imageV;
- }
- -(UILabel *)quesLab{
- if (!_quesLab) {
- _quesLab = [UILabel new];
- _quesLab.numberOfLines = 0;
- }
- return _quesLab;
- }
- /// type 0对1错2默认3多选题点后后变色 . */
- - (void)setItem:(AnswerItem *)Item
- {
- _item = Item;
- //0对1错2默认3多选题点后后变色
- if (Item.type == 0) {
- self.quesLab.textColor = defGreen;
-
- }else if (Item.type == 1){
- self.quesLab.textColor = UIColor.redColor;
-
- }else if (Item.type == 2){//默认和多选取消选中结果后变色
- self.quesLab.textColor = defGreen;
- }else if (Item.type == 3){
- self.quesLab.textColor = defGreen;
- }
- self.imageV.image = [UIImage imageNamed:Item.picname];
-
- self.quesLab.text = Item.text;
- }
- @end
|