Files
featherVoice/QXLive/Mine(音域)/View/钱包/QXWalletDateView.m
2025-08-08 10:49:36 +08:00

90 lines
3.2 KiB
Objective-C

//
// QXWalletDateView.m
// QXLive
//
// Created by 启星 on 2025/5/27.
//
#import "QXWalletDateView.h"
#import "QXRoomDetailHeaderView.h"
@interface QXWalletDateView()
@property (nonatomic,strong)UILabel *startLabel;
@property (nonatomic,strong)UIImageView *leadToImageView;
@property (nonatomic,strong)UILabel *endLabel;
@property (nonatomic,strong)UIImageView *dateImageView;
@property (nonatomic,strong)QXDatePickerView *pickerView;
@end
@implementation QXWalletDateView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = RGB16(0xF8F8F8);
[self addRoundedCornersWithRadius:5];
self.leadToImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"corn_date_lead_to"]];
[self addSubview:self.leadToImageView];
[self.leadToImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self).offset(-14);
make.size.mas_equalTo(CGSizeMake(14, 14));
make.centerY.equalTo(self);
}];
self.dateImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"corn_date"]];
[self addSubview:self.dateImageView];
[self.dateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self);
make.size.mas_equalTo(CGSizeMake(14, 14));
make.right.mas_equalTo(-12);
}];
self.startLabel = [[UILabel alloc] init];
self.startLabel.text = QXText(@"开始时间");
self.startLabel.font = [UIFont systemFontOfSize:13];
self.startLabel.textColor = RGB16(0xa6a6a6);
[self addSubview:self.startLabel];
[self.startLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.centerY.equalTo(self);
make.right.equalTo(self.leadToImageView.mas_left).offset(-5);
}];
self.endLabel = [[UILabel alloc] init];
self.endLabel.text = QXText(@"结束时间");
self.endLabel.font = [UIFont systemFontOfSize:13];
self.endLabel.textColor = RGB16(0xa6a6a6);
[self addSubview:self.endLabel];
[self.endLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.leadToImageView.mas_right).offset(12);
make.centerY.equalTo(self);
make.right.equalTo(self.dateImageView.mas_left).offset(-5);
}];
MJWeakSelf
[self addTapBlock:^(id _Nonnull obj) {
[weakSelf.pickerView show];
}];
}
-(QXDatePickerView *)pickerView{
if (!_pickerView) {
_pickerView = [[QXDatePickerView alloc] init];
_pickerView.pickerMode = BRDatePickerModeYMDHMS;
MJWeakSelf
_pickerView.selectedDateBlock = ^(NSString * _Nonnull startTime, NSDate * _Nonnull startDate, NSString * _Nonnull endTime, NSDate * _Nonnull endDate) {
weakSelf.startLabel.text = startTime;
weakSelf.endLabel.text = endTime;
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didSelectedStartDate:startDate:endDateString:endDate:)]) {
[weakSelf.delegate didSelectedStartDate:startTime startDate:startDate endDateString:endTime endDate:endDate];
}
};
}
return _pickerView;
}
@end