JXQuestionTableViewCell.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // JXQuestionTableViewCell.m
  3. // shiku_im
  4. //
  5. // Created by qiudezheng on 2020/4/29.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXQuestionTableViewCell.h"
  9. @implementation JXQuestionTableViewCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. + (instancetype)cellWithTableView:(UITableView *)tableView
  19. {
  20. static NSString *ID = @"JXQuestionTableViewCell";
  21. JXQuestionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  22. if (!cell) {
  23. cell = [[JXQuestionTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  24. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  25. }
  26. return cell;
  27. }
  28. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  29. {
  30. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  31. if(self)
  32. {
  33. self.boxImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 5, 20, 20)];
  34. self.boxImage.image = [UIImage imageNamed:@"question_null"];
  35. [self addSubview:self.boxImage];
  36. self.greenGouIMG = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
  37. self.greenGouIMG.image = [UIImage imageNamed:@"对的选项"];
  38. self.greenGouIMG.alpha=0.0;
  39. [self.boxImage addSubview:self.greenGouIMG];
  40. self.redGouIMG = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
  41. self.redGouIMG.alpha=0.0;
  42. self.redGouIMG.image = [UIImage imageNamed:@"矩形18拷贝2"];
  43. [self.boxImage addSubview:self.redGouIMG];
  44. self.answerLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.boxImage.frame)+15,5, JX_SCREEN_WIDTH/4, 30)];
  45. self.answerLabel.text = @"";
  46. self.answerLabel.textColor = [UIColor blackColor];
  47. self.answerLabel.font = [UIFont systemFontOfSize:15.0f];
  48. [self addSubview:self.answerLabel];
  49. //正确的
  50. self.correctImage = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.answerLabel.frame)+15, 5, 20, 20)];
  51. self.correctImage.image = [UIImage imageNamed:@"对的选项"];
  52. self.correctImage.alpha = 0.0f;
  53. [self addSubview:self.correctImage];
  54. //错误的
  55. self.wrongImage = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(self.answerLabel.frame)+15, 5, 20, 20)];
  56. self.wrongImage.image = [UIImage imageNamed:@"矩形18拷贝2"];
  57. self.wrongImage.alpha = 0.0f;
  58. [self addSubview:self.wrongImage];
  59. }
  60. return self;
  61. }
  62. @end