// // JXQuestionTableViewCell.m // shiku_im // // Created by qiudezheng on 2020/4/29. // Copyright © 2020 Reese. All rights reserved. // #import "JXQuestionTableViewCell.h" @implementation JXQuestionTableViewCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"JXQuestionTableViewCell"; JXQuestionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [[JXQuestionTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID]; cell.selectionStyle=UITableViewCellSelectionStyleNone; } return cell; } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if(self) { self.boxImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 5, 20, 20)]; self.boxImage.image = [UIImage imageNamed:@"question_null"]; [self addSubview:self.boxImage]; self.greenGouIMG = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)]; self.greenGouIMG.image = [UIImage imageNamed:@"对的选项"]; self.greenGouIMG.alpha=0.0; [self.boxImage addSubview:self.greenGouIMG]; self.redGouIMG = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)]; self.redGouIMG.alpha=0.0; self.redGouIMG.image = [UIImage imageNamed:@"矩形18拷贝2"]; [self.boxImage addSubview:self.redGouIMG]; self.answerLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.boxImage.frame)+15,5, JX_SCREEN_WIDTH/4, 30)]; self.answerLabel.text = @""; self.answerLabel.textColor = [UIColor blackColor]; self.answerLabel.font = [UIFont systemFontOfSize:15.0f]; [self addSubview:self.answerLabel]; //正确的 self.correctImage = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.answerLabel.frame)+15, 5, 20, 20)]; self.correctImage.image = [UIImage imageNamed:@"对的选项"]; self.correctImage.alpha = 0.0f; [self addSubview:self.correctImage]; //错误的 self.wrongImage = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.answerLabel.frame)+15, 5, 20, 20)]; self.wrongImage.image = [UIImage imageNamed:@"矩形18拷贝2"]; self.wrongImage.alpha = 0.0f; [self addSubview:self.wrongImage]; } return self; } @end