123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- //
- // CkeckCourceCell.m
- // LN_School
- //
- // Created by apple on 2017/4/12.
- // Copyright © 2017年 Danson. All rights reserved.
- //
- #import "CkeckCourceCell.h"
- @implementation CkeckCourceCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
-
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
- CGFloat x, y, w, h;
- x = 20;
- y = 5;
- w = 100;
- h = 35;
- UILabel *label = [[UILabel alloc] KSetxywh];
- [label setText:@"姓名" Font:Font21 TextColor:KTitleColor];
- [self.contentView addSubview:label];
- _nameLabel = label;
-
- x += w;
- y = 7.5;
- h = 30;
- label = [[UILabel alloc] KSetxywh];
- [label setText:@"第一阶段" Font:Font17 TextColor:KTitleColor];
- [self.contentView addSubview:label];
- _subjectLabel = label;
-
- x = 20;
- y = 40;
- w = kSize.width - 150;
- label = [[UILabel alloc] KSetxywh];
- [label setText:@"考核人:某某某" Font:Font17 TextColor:KTitleColor];
- [self.contentView addSubview:label];
- _CheckNameLabel = label;
-
- y += h;
- w = kSize.width - 150;
- label = [[UILabel alloc] KSetxywh];
- [label setText:@"培训时长:12小时0分钟" Font:Font17 TextColor:KTitleColor];
- [self.contentView addSubview:label];
- _timeLabel = label;
-
-
- x = kSize.width - 55;
- y = 10;
- w = h = 25;
- _selectImgView = [[UIImageView alloc] KSetxywh];
- [_selectImgView setModeAspectFill];
- _selectImgView.image = [UIImage imageNamed:@"selected"];
- [self.contentView addSubview:_selectImgView];
-
- y = 65;
- h = 25;
- NSString *titleS = @"学时送审";
- w = [titleS widthForFont:[UIFont systemFontOfSize:Font17]] + 10;
- x = kSize.width - w - 25;
- _checkBtn = [[UIButton alloc] KSetxywh];
- [_checkBtn setTitle:titleS textColor:RQMianColor font:Font17 fotState:UIControlStateNormal];
- [_checkBtn borderColor:RQMianColor width:1.3f cornorRadios:h/2.5];
- [_checkBtn target:self Tag:2];
- [self.contentView addSubview:_checkBtn];
- }
- return self;
- }
- -(void)setDataDic:(NSDictionary *)dataDic {
-
- _dataDic = dataDic;
- _nameLabel.text = dataDic[@"STUDENTNAME"];
-
- NSString *subjectString = @"";
- NSInteger subject = [dataDic[@"SUBJECT"] integerValue];
- switch (subject) {
- case 1:
- subjectString = @"第一阶段";
- break;
- case 2:
- subjectString = @"第二阶段";
- break;
- case 3:
- subjectString = @"第三阶段";
- break;
- case 4:
- subjectString = @"第四阶段";
- break;
-
- default:
- break;
- }
- _subjectLabel.text = subjectString;
-
- _timeLabel.text = dataDic[@"TRAINTIME"];
-
- if ([dataDic[@"EXAMERNAME"] length] < 1) {
- _CheckNameLabel.text = @"考核人:未考核";
- [_checkBtn setTitle:@"学时考核" forState:UIControlStateNormal];
- _checkBtn.tag = 1;
- }else {
- _CheckNameLabel.text = [NSString stringWithFormat:@"考核人:%@",dataDic[@"EXAMERNAME"]];;
- [_checkBtn setTitle:@"学时送审" forState:UIControlStateNormal];
- _checkBtn.tag = 2;
- }
- }
- - (void)clickSendBtnWithBlock:(MyBlockType)block {
- cellBlock = block;
- }
- - (void)btnClick:(UIButton *)sender {
- if (cellBlock) {
- //1代表考核 2代表送审
- cellBlock([NSString stringWithFormat:@"%d-%@",(int)sender.tag,_dataDic[@"STUDENT"]]);
- }
- }
- -(void)setCellIsSelected:(BOOL)cellIsSelected {
-
- _cellIsSelected = cellIsSelected;
- if (_isShowImg) {
- _selectImgView.hidden = NO;
-
- if (cellIsSelected) {
- _selectImgView.image = [UIImage imageNamed:@"selected_h"];
- }else {
- _selectImgView.image = [UIImage imageNamed:@"selected"];
- }
-
- }else {
- _selectImgView.hidden = YES;
- }
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- // Configure the view for the selected state
- }
- @end
|