//
|
// PBEditPersonCollectionViewCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/8/17.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBEditPersonCollectionViewCell.h"
|
@interface PBEditPersonCollectionViewCell()
|
@property (nonatomic, weak) UILabel *personNameL;
|
@property (nonatomic, weak) UIButton *deleteBtn;
|
@end
|
@implementation PBEditPersonCollectionViewCell
|
- (instancetype)initWithFrame:(CGRect)frame {
|
if (self = [super initWithFrame:frame]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
self.contentView.backgroundColor = [UIColor z_colorWithR:255 G:170 B:0 alpha:0.12];
|
UILabel *personNameL = [UILabel z_labelWithText:@"" Color:WarningColor isBold:NO Font:12];
|
personNameL.textAlignment = NSTextAlignmentCenter;
|
[self.contentView addSubview:personNameL];
|
[personNameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.contentView).offset(6);
|
make.bottom.equalTo(self.contentView).offset(-6);
|
make.left.equalTo(self.contentView).offset(8);
|
make.right.equalTo(self.contentView).offset(-26);
|
}];
|
UIButton *deleteBtn = [UIButton z_bgImageButton:[UIImage imageNamed:@"Issue_editPerson_delete"]];
|
[deleteBtn addTarget:self action:@selector(deleteBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.contentView addSubview:deleteBtn];
|
[deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.right.bottom.equalTo(self.contentView);
|
make.width.equalTo(@26);
|
}];
|
|
self.personNameL = personNameL;
|
self.deleteBtn = deleteBtn;
|
}
|
- (void)setIsHiddenDelete:(BOOL)isHiddenDelete {
|
_isHiddenDelete = isHiddenDelete;
|
}
|
- (void)setName:(NSString *)name {
|
_name = name;
|
self.personNameL.text = name;
|
if (self.isHiddenDelete) {
|
self.deleteBtn.hidden = YES;
|
}else {
|
self.deleteBtn.hidden = NO;
|
}
|
}
|
|
- (void)deleteBtnAction {
|
if (self.deletePersonBlock) {
|
self.deletePersonBlock();
|
}
|
}
|
@end
|