CkeckCourceCell.m 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //
  2. // CkeckCourceCell.m
  3. // LN_School
  4. //
  5. // Created by apple on 2017/4/12.
  6. // Copyright © 2017年 Danson. All rights reserved.
  7. //
  8. #import "CkeckCourceCell.h"
  9. @implementation CkeckCourceCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  14. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  15. if (self) {
  16. CGFloat x, y, w, h;
  17. x = 20;
  18. y = 5;
  19. w = 100;
  20. h = 35;
  21. UILabel *label = [[UILabel alloc] KSetxywh];
  22. [label setText:@"姓名" Font:Font21 TextColor:KTitleColor];
  23. [self.contentView addSubview:label];
  24. _nameLabel = label;
  25. x += w;
  26. y = 7.5;
  27. h = 30;
  28. label = [[UILabel alloc] KSetxywh];
  29. [label setText:@"第一阶段" Font:Font17 TextColor:KTitleColor];
  30. [self.contentView addSubview:label];
  31. _subjectLabel = label;
  32. x = 20;
  33. y = 40;
  34. w = kSize.width - 150;
  35. label = [[UILabel alloc] KSetxywh];
  36. [label setText:@"考核人:某某某" Font:Font17 TextColor:KTitleColor];
  37. [self.contentView addSubview:label];
  38. _CheckNameLabel = label;
  39. y += h;
  40. w = kSize.width - 150;
  41. label = [[UILabel alloc] KSetxywh];
  42. [label setText:@"培训时长:12小时0分钟" Font:Font17 TextColor:KTitleColor];
  43. [self.contentView addSubview:label];
  44. _timeLabel = label;
  45. x = kSize.width - 55;
  46. y = 10;
  47. w = h = 25;
  48. _selectImgView = [[UIImageView alloc] KSetxywh];
  49. [_selectImgView setModeAspectFill];
  50. _selectImgView.image = [UIImage imageNamed:@"selected"];
  51. [self.contentView addSubview:_selectImgView];
  52. y = 65;
  53. h = 25;
  54. NSString *titleS = @"学时送审";
  55. w = [titleS widthForFont:[UIFont systemFontOfSize:Font17]] + 10;
  56. x = kSize.width - w - 25;
  57. _checkBtn = [[UIButton alloc] KSetxywh];
  58. [_checkBtn setTitle:titleS textColor:RQMianColor font:Font17 fotState:UIControlStateNormal];
  59. [_checkBtn borderColor:RQMianColor width:1.3f cornorRadios:h/2.5];
  60. [_checkBtn target:self Tag:2];
  61. [self.contentView addSubview:_checkBtn];
  62. }
  63. return self;
  64. }
  65. -(void)setDataDic:(NSDictionary *)dataDic {
  66. _dataDic = dataDic;
  67. _nameLabel.text = dataDic[@"STUDENTNAME"];
  68. NSString *subjectString = @"";
  69. NSInteger subject = [dataDic[@"SUBJECT"] integerValue];
  70. switch (subject) {
  71. case 1:
  72. subjectString = @"第一阶段";
  73. break;
  74. case 2:
  75. subjectString = @"第二阶段";
  76. break;
  77. case 3:
  78. subjectString = @"第三阶段";
  79. break;
  80. case 4:
  81. subjectString = @"第四阶段";
  82. break;
  83. default:
  84. break;
  85. }
  86. _subjectLabel.text = subjectString;
  87. _timeLabel.text = dataDic[@"TRAINTIME"];
  88. if ([dataDic[@"EXAMERNAME"] length] < 1) {
  89. _CheckNameLabel.text = @"考核人:未考核";
  90. [_checkBtn setTitle:@"学时考核" forState:UIControlStateNormal];
  91. _checkBtn.tag = 1;
  92. }else {
  93. _CheckNameLabel.text = [NSString stringWithFormat:@"考核人:%@",dataDic[@"EXAMERNAME"]];;
  94. [_checkBtn setTitle:@"学时送审" forState:UIControlStateNormal];
  95. _checkBtn.tag = 2;
  96. }
  97. }
  98. - (void)clickSendBtnWithBlock:(MyBlockType)block {
  99. cellBlock = block;
  100. }
  101. - (void)btnClick:(UIButton *)sender {
  102. if (cellBlock) {
  103. //1代表考核 2代表送审
  104. cellBlock([NSString stringWithFormat:@"%d-%@",(int)sender.tag,_dataDic[@"STUDENT"]]);
  105. }
  106. }
  107. -(void)setCellIsSelected:(BOOL)cellIsSelected {
  108. _cellIsSelected = cellIsSelected;
  109. if (_isShowImg) {
  110. _selectImgView.hidden = NO;
  111. if (cellIsSelected) {
  112. _selectImgView.image = [UIImage imageNamed:@"selected_h"];
  113. }else {
  114. _selectImgView.image = [UIImage imageNamed:@"selected"];
  115. }
  116. }else {
  117. _selectImgView.hidden = YES;
  118. }
  119. }
  120. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  121. [super setSelected:selected animated:animated];
  122. // Configure the view for the selected state
  123. }
  124. @end