123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // PlanCell.m
- // jiaPeiC
- //
- // Created by apple on 15/12/18.
- // Copyright © 2015年 JCZ. All rights reserved.
- //
- #import "PlanCell.h"
- #import "UIImageView+WebCache.h"
- @interface PlanCell()
- @end
- @implementation PlanCell
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
-
- self.backgroundColor = backGroundColor;
-
- _headImg = [UIImageView new];
- [self.contentView addSubview:_headImg];
-
- UILabel *label = [UILabel new];
- [label setTextAlignment:NSTextAlignmentLeft];
- label.font = [UIFont scaleSize:Font18];
- [self.contentView addSubview:label];
- _nameLabel = label;
-
- UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.backgroundColor = defGreen;
- [btn setTitle:@"开始计时" forState:UIControlStateNormal];
- btn.titleLabel.textColor = [UIColor whiteColor];
- [self.contentView addSubview:btn];
- _on_offBtn = btn;
-
- btn = [UIButton buttonWithType:UIButtonTypeCustom];
- btn.backgroundColor = [UIColor clearColor];
- [btn addTarget:self action:@selector(clickToTel) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:btn];
- _telBtn = btn;
- }
- return self;
- }
- +(PlanCell*)cellForTabelView:(UITableView*)tableView
- {
- PlanCell* cell = [tableView dequeueReusableCellWithIdentifier:@"PlanCell"];
- if (!cell) {
- cell = [[PlanCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"PlanCell"];
- }
- return cell;
- }
- -(void)setModel:(NSDictionary *)model
- {
- /*
- RO_STATUS = ,
- RI_TIME = 14:00-17:00,
- RI_STATUS = 1,
- RO_ID = ,
- RI_ID = 103,
- CRDATE = 2017-02-16 11:02,
- RI_USER_TEL = 15188352230,
- PHOTO = http://fj.jppt.com.cn/http://image.jppt.com.cn/public/user/201701/1485147543320.jpg,
- RI_TASK_ID = 187,
- RI_REASON = Jiushibuxiang,
- RI_USER_NAME = 廖国荣,
- RI_USER = 1
- */
- _model = model;
-
- NSString *headString = model[@"PHOTO"];
- if (!headString || headString.length == 0) {
- headString = model[@"HEADIMG"];
- }
- if (!headString) {
- headString = @"";
- }
- [_headImg sd_setImageWithURL:[NSURL URLWithString:headString] placeholderImage:[UIImage imageNamed:@"noHeadImg.png"]];
- _nameLabel.text = model[@"RI_USER_NAME"];
- [_telBtn setTitle:model[@"RI_USER_TEL"] textColor:defGreen font:Font16 fotState:UIControlStateNormal];
- }
- -(void)clickToTel
- {
- //拨打电话
- NSString* tel = _model[@"RI_USER_TEL"];
- if (tel && ![tel isEqualToString:@""]) {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",tel]]];
- }
- }
- -(void)layoutSubviews
- {
- [super layoutSubviews];
- CGFloat wid = self.width;
- CGFloat x,y,w,h,bd;
-
- x = y = bd = 10;
- w = 70;
- h = 80;
- _headImg.frame = setDIYFrame;
- [_headImg borderColor:defGreen width:1 cornorRadios:5];
-
- x += w + bd;
- w = 80;
- h = 30;
- _nameLabel.frame = setDIYFrame;
-
- x += w;
- y += bd/2.0;
- w = wid - x - bd;
- h = 30;
- _telBtn.frame = setDIYFrame;
-
-
- x = _headImg.width + 2*bd;
- y += h + bd;
- w = wid - x - 2*bd;
- _on_offBtn.frame = setDIYFrame;
- [_on_offBtn borderColor:defGreen width:1 cornorRadios:5];
- }
- @end
|