| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- //
- // USADAKAWorkOutCollectionCell.m
- // shiku_im
- //
- // Created by liyangyang-pc on 2018/5/17.
- //
- #import "USADAKAWorkOutCollectionCell.h"
- @interface USADAKAWorkOutCollectionCell()
- @property (strong , nonatomic) UILabel *nameLabel;
- @property (strong , nonatomic) UIButton *shensubtn;
- @end
- @implementation USADAKAWorkOutCollectionCell
- - (instancetype)init
- {
- self = [super init];
- if (self) {
-
- [self createUI];
-
- }
- return self;
- }
- - (instancetype)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
-
- [self createUI];
-
- }
- return self;
- }
- - (void)createUI{
- self.contentView.backgroundColor = [UIColor whiteColor];;
- [self.contentView addSubview:self.nameLabel];
- [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.equalTo(self.contentView);
- make.width.mas_equalTo(40);
-
- }];
- [self.contentView addSubview:self.shensubtn];
- [self.shensubtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLabel.mas_right).offset(0);
- make.top.equalTo(self.contentView).offset(2);
- make.width.mas_equalTo(45);
- make.height.mas_equalTo(17);
-
- }];
-
-
- }
- -(UILabel *)nameLabel
- {
- if (!_nameLabel) {
- _nameLabel = [[UILabel alloc]init];
- _nameLabel.font = FONT_SIZE(14);
- _nameLabel.textColor = Color(153, 153, 153, 1.0);
- _nameLabel.text = @"旷工";
- _nameLabel.backgroundColor = [UIColor whiteColor];
- }
- return _nameLabel;
- }
- -(UIButton *)shensubtn
- {
- if (!_shensubtn) {
- _shensubtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_shensubtn setTitle:@"申诉" forState:UIControlStateNormal];
- [_shensubtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- _shensubtn.titleLabel.font = FONT_SIZE(13);
- [_shensubtn setBackgroundColor:Color(51, 168, 238, 1.0) forState:UIControlStateNormal];
- [_shensubtn addTarget:self action:@selector(bukaAction:) forControlEvents:UIControlEventTouchUpInside];
- _shensubtn.layer.masksToBounds = YES;
- _shensubtn.layer.cornerRadius = 8.0f;
- }
- return _shensubtn;
- }
- - (void)bukaAction:(UIButton *)sender{
- if (self.blcok) {
- NSString *str = @"";
- if (self.shensubtn.tag == 11) {
- str = FORMAT(@"%@ %@:00",self.model.date,self.model.wd_onduty);
- }else
- {
- str = FORMAT(@"%@ %@:00",self.model.date,self.model.wd_offduty);
- }
- self.blcok(str);
- }
- }
- -(void)setModel:(UASDAKAClassModel *)model
- {
- _model = model;
- self.shensubtn.tag = model.indexPath;
- if (model.indexPath == 11) {
-
- if (model.onduty_apprecord) {
- [self.shensubtn setTitle:@"申诉中" forState:UIControlStateNormal];
- [self.shensubtn setUserInteractionEnabled:NO];
- [self.shensubtn setBackgroundColor:Color(153, 153, 153, 1.0) forState:UIControlStateNormal];
- [self.shensubtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(48+cellScale);
- }];
- [self.shensubtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- }
- }else
- {
- if (model.offduty_apprecord) {
- [self.shensubtn setTitle:@"申诉中" forState:UIControlStateNormal];
- [self.shensubtn setUserInteractionEnabled:NO];
- [self.shensubtn setBackgroundColor:Color(153, 153, 153, 1.0) forState:UIControlStateNormal];
- [self.shensubtn mas_updateConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(48+cellScale);
- }];
- [self.shensubtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-
- }
-
- }
-
-
- }
- @end
|