|
|
|
|
//
|
|
|
|
|
// WatchDialCollectionViewCell.m
|
|
|
|
|
// tongxin
|
|
|
|
|
//
|
|
|
|
|
// Created by ecell on 2023/3/24.
|
|
|
|
|
// Copyright © 2023 xTT. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "WatchDialCollectionViewCell.h"
|
|
|
|
|
|
|
|
|
|
@interface WatchDialCollectionViewCell ()
|
|
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIImageView *iconImg;
|
|
|
|
|
@property (nonatomic ,weak) UILabel *titleLabel;
|
|
|
|
|
@property (nonatomic ,weak) UILabel *moneyLabel;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation WatchDialCollectionViewCell
|
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame
|
|
|
|
|
{
|
|
|
|
|
self = [super initWithFrame:frame];
|
|
|
|
|
if (self)
|
|
|
|
|
{
|
|
|
|
|
self.backgroundColor = UIColor.whiteColor;
|
|
|
|
|
self.layer.cornerRadius = 5;
|
|
|
|
|
self.layer.masksToBounds = YES;
|
|
|
|
|
[self subhomeCell];
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setModel:(DialMsgModel *)model
|
|
|
|
|
{
|
|
|
|
|
_model = model;
|
|
|
|
|
[self.iconImg sd_setImageWithURL:[NSURL URLWithString:model.dialPreView] placeholderImage:[UIImage imageNamed:@""]];
|
|
|
|
|
self.titleLabel.text = model.dialName;
|
|
|
|
|
self.moneyLabel.text = [NSString stringWithFormat:@" ¥%@ ",model.price];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setMymodel:(DialMsgModel *)Mymodel
|
|
|
|
|
{
|
|
|
|
|
_Mymodel = Mymodel;
|
|
|
|
|
[self.iconImg sd_setImageWithURL:[NSURL URLWithString:Mymodel.dialPreView] placeholderImage:[UIImage imageNamed:@""]];
|
|
|
|
|
self.titleLabel.text = Mymodel.dialName;
|
|
|
|
|
self.moneyLabel.text = @" 同步到手表 ";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)subhomeCell
|
|
|
|
|
{
|
|
|
|
|
UIImageView *iconImg = [UIImageView new];
|
|
|
|
|
self.iconImg = iconImg;
|
|
|
|
|
[self.contentView addSubview:iconImg];
|
|
|
|
|
[iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.equalTo(self.contentView);
|
|
|
|
|
make.top.equalTo(self.contentView).offset(10);
|
|
|
|
|
make.height.width.mas_equalTo((ScreenWidth-120)/2);
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
UILabel *moneyLabel = [UILabel new];
|
|
|
|
|
moneyLabel.textColor = UIColor.whiteColor;
|
|
|
|
|
moneyLabel.backgroundColor = mainColor;
|
|
|
|
|
moneyLabel.layer.cornerRadius = 13;
|
|
|
|
|
moneyLabel.layer.masksToBounds = YES;
|
|
|
|
|
moneyLabel.userInteractionEnabled = YES;
|
|
|
|
|
moneyLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 15];
|
|
|
|
|
self.moneyLabel = moneyLabel;
|
|
|
|
|
[self.contentView addSubview:moneyLabel];
|
|
|
|
|
[moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.equalTo(self.contentView);
|
|
|
|
|
make.bottom.equalTo(self.contentView.mas_bottom).inset(10);
|
|
|
|
|
make.height.mas_equalTo(26);
|
|
|
|
|
}];
|
|
|
|
|
UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside:)];
|
|
|
|
|
[moneyLabel addGestureRecognizer:labelTapGestureRecognizer];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UILabel *titleLabel = [UILabel new];
|
|
|
|
|
titleLabel.textColor = UIColor.blackColor;
|
|
|
|
|
self.titleLabel = titleLabel;
|
|
|
|
|
titleLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 15];
|
|
|
|
|
[self.contentView addSubview:titleLabel];
|
|
|
|
|
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.equalTo(self.contentView);
|
|
|
|
|
make.bottom.equalTo(moneyLabel.mas_top).inset(5);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-(void) labelTouchUpInside:(UITapGestureRecognizer *)recognizer
|
|
|
|
|
{
|
|
|
|
|
UILabel *label=(UILabel*)recognizer.view;
|
|
|
|
|
|
|
|
|
|
NSLog(@"%@被点击了",label.text);
|
|
|
|
|
self.labelTouch([label.text isEqualToString:@" 同步到手表 "] ? self.Mymodel : self.model);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|