//
|
// PBViewPointDetailCell.m
|
// IphoneBIMe
|
//
|
// Created by zjf on 2018/7/24.
|
// Copyright © 2018年 ProBIM. All rights reserved.
|
//
|
|
#import "PBViewPointDetailCell.h"
|
#import "PBViewPointModel.h"
|
@interface PBViewPointDetailCell()
|
@property (nonatomic, weak) UILabel *viewPointNameL;
|
@property (nonatomic, weak) UILabel *viewPointDescL;
|
@property (nonatomic, weak) UILabel *creatorL;
|
@property (nonatomic, weak) UILabel *updateTimeL;
|
@property (nonatomic, weak) UILabel *isDefaultL;
|
@end
|
@implementation PBViewPointDetailCell
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
[self setupUI];
|
}
|
return self;
|
}
|
- (void)setupUI {
|
UILabel *viewPointNameL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:TitleFontSize];
|
viewPointNameL.numberOfLines = 0;
|
[self.contentView addSubview:viewPointNameL];
|
[viewPointNameL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(self.contentView).offset(20);
|
make.left.equalTo(self.contentView).offset(16);
|
make.right.equalTo(self.contentView).offset(-16);
|
}];
|
|
UILabel *viewPointDescL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize];
|
viewPointDescL.numberOfLines = 0;
|
[self.contentView addSubview:viewPointDescL];
|
[viewPointDescL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(viewPointNameL.mas_bottom).offset(10);
|
make.left.right.equalTo(viewPointNameL);
|
}];
|
|
// UILabel *creatorL = [UILabel z_labelWithText:@"" Color:TitleColor isBold:NO Font:TitleFontSize];
|
// creatorL.numberOfLines = 0;
|
// [self.contentView addSubview:creatorL];
|
// [creatorL mas_makeConstraints:^(MASConstraintMaker *make) {
|
// make.top.equalTo(viewPointDescL.mas_bottom).offset(20);
|
// make.left.right.equalTo(viewPointNameL);
|
// }];
|
UILabel *updateTimeL = [UILabel z_labelWithText:@"" Color:DescColor isBold:NO Font:DescFontSize];
|
[self.contentView addSubview:updateTimeL];
|
[updateTimeL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(viewPointDescL.mas_bottom).offset(10);
|
make.left.right.equalTo(viewPointNameL);
|
}];
|
UILabel *isDefaultL = [UILabel z_labelWithText:@"默认" Color:IndicatedColor isBold:YES Font:DescFontSize];
|
[self.contentView addSubview:isDefaultL];
|
[isDefaultL mas_makeConstraints:^(MASConstraintMaker *make) {
|
make.top.equalTo(updateTimeL.mas_bottom).offset(10);
|
make.left.equalTo(viewPointNameL);
|
make.height.equalTo(@22);
|
make.bottom.equalTo(self.contentView).offset(-20);
|
}];
|
|
self.viewPointNameL = viewPointNameL;
|
self.viewPointDescL = viewPointDescL;
|
// self.creatorL = creatorL;
|
self.updateTimeL = updateTimeL;
|
self.isDefaultL = isDefaultL;
|
}
|
|
- (void)setViewPointModel:(PBViewPointModel *)viewPointModel {
|
_viewPointModel = viewPointModel;
|
self.viewPointNameL.text = viewPointModel.Name;
|
NSDictionary *dict = [NSString convertTodictionaryOrArr:viewPointModel.Tag];
|
id desc = [dict valueForKey:@"description"];
|
if ([desc isKindOfClass:[NSString class]]) {
|
self.viewPointDescL.text = [desc isEqualToString:@""] ? @"<无描述>" : desc;
|
}else {
|
self.viewPointDescL.text = @"<无描述>";
|
}
|
// self.creatorL.text = [NSString stringWithFormat:@"创建人 %@",viewPointModel.Editor];
|
self.updateTimeL.text = [NSString stringWithFormat:@"更新时间 %@",[viewPointModel.EditTime stringByReplacingOccurrencesOfString:@"T" withString:@" "]];
|
if (viewPointModel.IsDefault) {
|
self.isDefaultL.hidden = NO;
|
}else {
|
self.isDefaultL.hidden = YES;
|
}
|
}
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
[super setSelected:selected animated:animated];
|
|
// Configure the view for the selected state
|
}
|
|
@end
|