//
|
// PBChooseTableViewCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/8/15.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBChooseTableViewCell.h"
|
#import "PBIssueAddModel.h"
|
|
@interface PBChooseTableViewCell()
|
@property (nonatomic, weak) UILabel *leftTitleL;
|
@property (nonatomic, weak) UILabel *rightTitleL;
|
@property (nonatomic, weak) UILabel *leftSelectL;
|
@property (nonatomic, weak) UILabel *rightSelectL;
|
|
@end
|
@implementation PBChooseTableViewCell
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
UIView *topView = [[UIView alloc] init];
|
topView.backgroundColor = [UIColor z_colorWithR:242 G:242 B:242];
|
[self.contentView addSubview:topView];
|
[topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.left.right.equalTo(self.contentView);
|
make.height.equalTo(@10);
|
}];
|
UIView *linView = [[UIView alloc] init];
|
linView.backgroundColor = [UIColor z_colorWithR:242 G:242 B:242];
|
[self.contentView addSubview:linView];
|
[linView mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(topView.mas_bottom).offset(16);
|
make.bottom.equalTo(self.contentView).offset(-22);
|
make.centerX.equalTo(self.contentView);
|
make.width.equalTo(@1);
|
make.height.equalTo(@55);
|
}];
|
UIButton *statusBtn = [[UIButton alloc] init];
|
[statusBtn addTarget:self action:@selector(statusBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.contentView addSubview:statusBtn];
|
[statusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(topView.mas_bottom);
|
make.left.bottom.equalTo(self.contentView);
|
make.right.equalTo(linView.mas_left);
|
}];
|
|
UIButton *typeBtn = [[UIButton alloc] init];
|
[typeBtn addTarget:self action:@selector(typeBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.contentView addSubview:typeBtn];
|
[typeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(topView.mas_bottom);
|
make.right.bottom.equalTo(self.contentView);
|
make.left.equalTo(linView.mas_right);
|
}];
|
|
UILabel *statusTieleL = [UILabel z_labelWithText:@"" Color:PromptColor isBold:NO Font:DescFontSize];
|
[self.contentView addSubview:statusTieleL];
|
[statusTieleL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(topView.mas_bottom).offset(16);
|
make.centerX.equalTo(statusBtn);
|
make.height.equalTo(@20);
|
}];
|
|
UILabel *typeTieleL = [UILabel z_labelWithText:@"" Color:PromptColor isBold:NO Font:DescFontSize];
|
[self.contentView addSubview:typeTieleL];
|
[typeTieleL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(topView.mas_bottom).offset(16);
|
make.centerX.equalTo(typeBtn);
|
make.height.equalTo(@20);
|
}];
|
|
UILabel *statusSelectL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:MarkedFontSize];
|
statusSelectL.textAlignment = NSTextAlignmentCenter;
|
[self.contentView addSubview:statusSelectL];
|
[statusSelectL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(statusTieleL.mas_bottom).offset(16);
|
make.left.equalTo(statusBtn).offset(16);
|
make.right.equalTo(statusBtn).offset(-16);
|
make.height.equalTo(@25);
|
}];
|
|
UILabel *typeSelectL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:MarkedFontSize];
|
typeSelectL.textAlignment = NSTextAlignmentCenter;
|
[self.contentView addSubview:typeSelectL];
|
[typeSelectL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(typeTieleL.mas_bottom).offset(16);
|
make.left.equalTo(typeBtn).offset(16);
|
make.right.equalTo(typeBtn).offset(-16);
|
make.height.equalTo(@25);
|
}];
|
self.leftTitleL = statusTieleL;
|
self.rightTitleL = typeTieleL;
|
self.leftSelectL = statusSelectL;
|
self.rightSelectL = typeSelectL;
|
}
|
- (void)statusBtnAction {
|
if (!self.leftIssueAddModel.isIssueManager) {
|
return;
|
}
|
if (self.ChooseBlock) {
|
self.ChooseBlock(0);
|
}
|
}
|
- (void)typeBtnAction {
|
if (self.rightIssueAddModel.isAddIssue || self.rightIssueAddModel.isIssueManager) {
|
if (self.ChooseBlock) {
|
self.ChooseBlock(1);
|
}
|
}
|
}
|
|
- (void)setLeftIssueAddModel:(PBIssueAddModel *)leftIssueAddModel {
|
_leftIssueAddModel = leftIssueAddModel;
|
if (leftIssueAddModel.isAddIssue) {
|
self.leftTitleL.text = leftIssueAddModel.title;
|
self.leftSelectL.text = @"打开";
|
}else {
|
self.leftTitleL.text = leftIssueAddModel.title;
|
if(_leftIssueAddModel.navModel) {
|
self.leftSelectL.text = leftIssueAddModel.navModel.ItemName;
|
// self.leftSelectL.textColor = TitleColor;
|
}else {
|
self.leftSelectL.text = leftIssueAddModel.prompt;
|
// self.leftSelectL.textColor = TitleColor;
|
}
|
if (self.leftIssueAddModel.isIssueManager) {
|
self.leftSelectL.textColor = TitleColor;
|
}else {
|
self.leftSelectL.textColor = PromptColor;
|
}
|
|
|
}
|
}
|
- (void)setRightIssueAddModel:(PBIssueAddModel *)rightIssueAddModel {
|
_rightIssueAddModel = rightIssueAddModel;
|
self.rightTitleL.text = rightIssueAddModel.title;
|
if(_rightIssueAddModel.navModel) {
|
self.rightSelectL.text = rightIssueAddModel.navModel.ItemName;
|
// self.rightSelectL.textColor = TitleColor;
|
}else {
|
self.rightSelectL.text = rightIssueAddModel.prompt;
|
// self.rightSelectL.textColor = TitleColor;
|
}
|
if (self.rightIssueAddModel.isAddIssue || self.rightIssueAddModel.isIssueManager){
|
self.rightSelectL.textColor = TitleColor;
|
}else {
|
self.rightSelectL.textColor = PromptColor;
|
}
|
|
}
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
[super setSelected:selected animated:animated];
|
|
// Configure the view for the selected state
|
}
|
|
@end
|