You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
3.3 KiB
103 lines
3.3 KiB
![]()
2 years ago
|
//
|
||
|
// TimeframeTableViewCell.m
|
||
|
// tongxin
|
||
|
//
|
||
|
// Created by ecell on 2023/7/12.
|
||
|
// Copyright © 2023 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TimeframeTableViewCell.h"
|
||
|
|
||
|
@interface TimeframeTableViewCell ()
|
||
|
|
||
|
@property (nonatomic ,weak) UILabel *timeLabel;
|
||
|
@property (nonatomic ,weak) UILabel *weekLabel;
|
||
|
|
||
|
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation TimeframeTableViewCell
|
||
|
|
||
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||
|
{
|
||
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||
|
if (self)
|
||
|
{
|
||
|
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||
|
self.backgroundColor = KKClearColor;
|
||
|
[self subCellView];
|
||
|
}
|
||
|
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)setModelDic:(NSDictionary *)modelDic
|
||
|
{
|
||
|
_modelDic = modelDic;
|
||
|
self.timeLabel.text = F(@"%@-%@", modelDic[@"s"],modelDic[@"e"]);
|
||
|
NSMutableArray *weekArr = [UICommon getWeekStr:modelDic[@"w"]];
|
||
|
for (NSString *str in [UICommon getWeekStr:modelDic[@"w"]])
|
||
|
{
|
||
|
if (str.length <= 0)
|
||
|
[weekArr removeObject:str];
|
||
|
}
|
||
|
if (weekArr.count == 2 &&
|
||
|
[weekArr[0] isEqualToString:@"周六"] &&
|
||
|
[weekArr[1] isEqualToString:@"周日"])
|
||
|
self.weekLabel.text = @"周末";
|
||
|
else if (weekArr.count == 5 &&
|
||
|
[weekArr[0] isEqualToString:@"周一"] &&
|
||
|
[weekArr[1] isEqualToString:@"周二"] &&
|
||
|
[weekArr[2] isEqualToString:@"周三"] &&
|
||
|
[weekArr[3] isEqualToString:@"周四"] &&
|
||
|
[weekArr[4] isEqualToString:@"周五"])
|
||
|
self.weekLabel.text = @"工作日";
|
||
|
else if (weekArr.count == 7 &&
|
||
|
[weekArr[0] isEqualToString:@"周一"] &&
|
||
|
[weekArr[1] isEqualToString:@"周二"] &&
|
||
|
[weekArr[2] isEqualToString:@"周三"] &&
|
||
|
[weekArr[3] isEqualToString:@"周四"] &&
|
||
|
[weekArr[4] isEqualToString:@"周五"] &&
|
||
|
[weekArr[5] isEqualToString:@"周六"] &&
|
||
|
[weekArr[6] isEqualToString:@"周日"])
|
||
|
self.weekLabel.text = @"每天";
|
||
|
else
|
||
|
self.weekLabel.text = F(@"%@", [weekArr componentsJoinedByString:@"、"]);
|
||
|
}
|
||
|
|
||
|
- (void)subCellView
|
||
|
{
|
||
|
/// 时间
|
||
|
UILabel *timeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(20) textColor:KKTextColor text:@"" Radius:0];
|
||
|
self.timeLabel = timeLabel;
|
||
|
[self.contentView addSubview:timeLabel];
|
||
|
[timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.equalTo(self.contentView).offset(15);
|
||
|
make.bottom.equalTo(self.contentView.mas_centerY).inset(5);
|
||
|
}];
|
||
|
|
||
|
UILabel *weekLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:FontADA_(18) textColor:KKTextColor text:@"" Radius:0];
|
||
|
self.weekLabel = weekLabel;
|
||
|
[self.contentView addSubview:weekLabel];
|
||
|
[weekLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.equalTo(self.contentView).offset(15);
|
||
|
make.top.equalTo(self.contentView.mas_centerY).offset(5);
|
||
|
}];
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
- (void)awakeFromNib {
|
||
|
[super awakeFromNib];
|
||
|
// Initialization code
|
||
|
}
|
||
|
|
||
|
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||
|
[super setSelected:selected animated:animated];
|
||
|
|
||
|
// Configure the view for the selected state
|
||
|
}
|
||
|
|
||
|
@end
|