123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- //
- // ComListCell.m
- // LNManager
- //
- // Created by EchoShacolee on 2017/5/31.
- // Copyright © 2017年 lee. All rights reserved.
- //
- #import "ComListCell.h"
- @interface ComListCell()
- {
-
- UILabel *_coach;
- UILabel *_school;
- UILabel *_deptopinion;
- UILabel *_schopinion;
- UILabel *_content;
- UILabel *_student;
- UILabel *_time;
-
- UIButton *_oneBtn;
- UIView *_view;
- }
- @end
- @implementation ComListCell
- +(ComListCell *)cellForTabelView:(UITableView *)tableView{
-
- ComListCell* cell = [tableView dequeueReusableCellWithIdentifier:@"ComListCell"];
- if (!cell) {
- cell = [[ComListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ComListCell"];
- }
- return cell;
- }
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.contentView.backgroundColor = [UIColor whiteColor];
-
- NSArray * textArr = @[@"被投诉教练",@"机构名字",@"DEPTOPINION",@"SCHOPINION",@"评价内容",@"时间",@"学员"];
- NSMutableArray * labArr = [NSMutableArray new];
- //
- for (int i=0; i<textArr.count; i++) {
- UILabel * lab = [[UILabel alloc]init];
- lab.textColor = [UIColor blackColor];
- lab.textAlignment = NSTextAlignmentLeft;
- lab.font = [UIFont systemFontOfSize:14];
- [self.contentView addSubview:lab];
- [labArr addObject:lab];
- }
- _coach = labArr[0];
- _school = labArr[1];
- _deptopinion = labArr[2];
- _schopinion = labArr[3];
- _content = labArr[4];
- _time = labArr[5];
- _student = labArr[6];
-
- _time.textAlignment = NSTextAlignmentRight;
- _time.textColor = [UIColor lightGrayColor];
- _time.font = [UIFont systemFontOfSize:12];
-
- _content.numberOfLines = 0;
- _deptopinion.numberOfLines = 0;
- _schopinion.numberOfLines = 0;
-
- _oneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_oneBtn setTitle:@"处理" textColor:RQMianColor font:15 fotState:UIControlStateNormal];
- [_oneBtn borderColor:RQMianColor width:1 cornorRadios:5];
- [_oneBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:_oneBtn];
-
- _view = [UIView new];
- _view.backgroundColor = KBackGroundColor;
- [self.contentView addSubview:_view];
- }
- return self;
- }
- - (void)updateWithDic:(NSDictionary *)dic {
- NSString *type = [NSString stringWithFormat:@"%@",dic[@"TYPE"]];
- if ([type isEqualToString:@"1"]) {
- _coach.text = [NSString stringWithFormat:@"被投诉教练 :%@",dic[@"OBJNAME"]];
- _school.text = [NSString stringWithFormat:@"所属机构 :%@",dic[@"OBJNAME"]];
- }else{
-
- _coach.text = @"";
- _school.text = [NSString stringWithFormat:@"被投诉机构 :%@",dic[@"OBJNAME"]];
- }
-
- NSString * timeStr = dic[@"CRTIME"];
-
- _time.text = [NSString stringWithFormat:@"%@",timeStr];
-
- if ([dic[@"CONTENT"] length] != 0) {
- _content.text = [NSString stringWithFormat:@"投诉内容 :%@",dic[@"CONTENT"]];
- }else{
-
- _content.text = @"";
- }
-
- if ([dic[@"SCHOPIONION"] length] != 0) {
- _schopinion.text = [NSString stringWithFormat:@"机构意见 :%@",dic[@"SCHOPIONION"]];
- }else{
-
- _schopinion.text = @"";
- }
-
- if ([dic[@"DEPAOPINION"] length] != 0) {
- _deptopinion.text = [NSString stringWithFormat:@"我的意见 :%@",dic[@"DEPAOPINION"]];
- }else{
-
- _deptopinion.text = @"";
- }
- _student.text = [NSString stringWithFormat:@"学员 :%@",dic[@"STUNAME"]];
-
- }
- - (void)layoutSubviews{
-
- CGFloat wid = self.width;
- CGFloat x,y,w,h,bd;
-
- x = 0;
- w = wid;
- y = 0;
- h = 20;
- _view.frame = KSetDIYFrame;
-
- y += 5;
-
- x = 20;
- y += h;
- bd = 5;
- w = wid - 40;
- h = 17;
- y += bd;
- _coach.frame = KSetDIYFrame;
- _time.frame = KSetDIYFrame;
-
- y += h+bd;
- h = 17;
- _school.frame = KSetDIYFrame;
- if (_time.frame.size.height == 0) {
- _time.frame = KSetDIYFrame;
- }
-
- y += h;
- h = [_content.text heightForWid:w Font:14];
- if (h != 0) {
- y += bd;
- }
- _content.frame = KSetDIYFrame;
-
- y += h;
- h = [_schopinion.text heightForWid:w Font:14];
- if (h != 0) {
- y += bd;
- }
- _schopinion.frame = KSetDIYFrame;
-
- y += h;
- h = [_deptopinion.text heightForWid:w Font:14];
- if (h != 0) {
- y += bd;
- }
- _deptopinion.frame = KSetDIYFrame;
-
- y += h+bd;
- x = wid-70;
- h = 25;
- w = 50;
- _oneBtn.frame = KSetDIYFrame;
-
- // y += h;
- // _student.frame = KSetDIYFrame;
- }
- -(void)btnClick:(UIButton *)sender{
-
- if (self.block) {
- self.block();
- }
- }
- - (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
- }
- @end
|