// // WatchHomeMenuTableViewCell.m // tongxin // // Created by ecell on 2023/4/25. // Copyright © 2023 xTT. All rights reserved. // #import "WatchHomeMenuTableViewCell.h" #import "User.h" #import "Device.h" @interface WatchHomeMenuTableViewCell () @property (nonatomic ,weak) UILabel *msgLabel; @property (nonatomic ,weak) UIImageView *iconImg; @end @implementation WatchHomeMenuTableViewCell - (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)setImageStr:(NSString *)imageStr { _imageStr = imageStr; self.iconImg.image = ImageName_(imageStr); } - (void)setTitleStr:(NSString *)titleStr { _titleStr = titleStr; self.titleLabel.text = titleStr; self.msgLabel.text = @""; if ([titleStr isEqualToString:@"拒接陌生人来电"]) self.msgLabel.text = [cUser.cDevice.opRejectStrangeCall boolValue] ? @"已开启" : @"已关闭"; if ([titleStr isEqualToString:@"手表拨号"]) self.msgLabel.text = [cUser.cDevice.opDialSwitch boolValue] ? @"已开启" : @"已关闭"; } - (void)setSwithStr:(NSString *)swithStr { _swithStr = swithStr; self.msgLabel.text = swithStr; } - (void)subCellView { UIImageView *iconImg = [UICommon ui_imageView:CGRectZero fileName:@"comm_set_msg_icon"]; self.iconImg = iconImg; [self.contentView addSubview:iconImg]; [iconImg mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.contentView); make.left.equalTo(self.contentView).offset(30); make.size.mas_equalTo(CGSizeMake(24, 24)); }]; UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentCenter font:FontBold_(16) textColor:KKTextBlackColor text:@"" Radius:0]; self.titleLabel = titleLabel; [self.contentView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImg.mas_right).offset(6); make.centerY.equalTo(self.contentView); }]; /// 右箭头 UIImageView *rightImg = [UICommon ui_imageView:CGRectZero fileName:@"icon_enter_gray"]; [self.contentView addSubview:rightImg]; [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.equalTo(self.contentView); make.right.equalTo(self.contentView.mas_right).inset(30); make.size.mas_equalTo(rightImg.image.size); }]; UILabel *msgLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(14) textColor:KKGrey102 text:@"" Radius:0]; self.msgLabel = msgLabel; [self.contentView addSubview:msgLabel]; [msgLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(rightImg.mas_left).inset(5); make.centerY.equalTo(self.contentView); }]; } - (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