|
|
// |
|
|
// MusicListTableViewCell.m |
|
|
// Lookfit |
|
|
// |
|
|
// Created by ecell on 2023/3/13. |
|
|
// Copyright © 2023 Sheldon. All rights reserved. |
|
|
// |
|
|
|
|
|
#import "MusicListTableViewCell.h" |
|
|
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width |
|
|
|
|
|
@interface MusicListTableViewCell () |
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UIImageView *selectImg; |
|
|
|
|
|
|
|
|
@property (nonatomic ,weak) UILabel *nameLabel; |
|
|
|
|
|
@property (nonatomic ,weak) UILabel *msgLabel; |
|
|
|
|
|
@property (nonatomic ,weak) UILabel *numberLabel; |
|
|
|
|
|
@end |
|
|
|
|
|
@implementation MusicListTableViewCell |
|
|
|
|
|
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier |
|
|
{ |
|
|
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; |
|
|
if (self) |
|
|
{ |
|
|
self.selectionStyle = UITableViewCellSelectionStyleNone; |
|
|
self.backgroundColor = UIColor.clearColor; |
|
|
[self subCellView]; |
|
|
} |
|
|
|
|
|
return self; |
|
|
} |
|
|
|
|
|
- (void)setIsSelect:(BOOL)isSelect |
|
|
{ |
|
|
_isSelect = isSelect; |
|
|
self.numberLabel.hidden = isSelect; |
|
|
self.selectImg.hidden = !isSelect; |
|
|
} |
|
|
|
|
|
- (void)setCoutn:(NSInteger)coutn |
|
|
{ |
|
|
_coutn = coutn; |
|
|
self.numberLabel.text = [NSString stringWithFormat:@"%ld",coutn]; |
|
|
} |
|
|
|
|
|
- (void)setMsgModel:(MusicModel *)msgModel |
|
|
{ |
|
|
_msgModel = msgModel; |
|
|
self.nameLabel.text = [NSString stringWithFormat:@"%@.MP3",msgModel.name]; |
|
|
self.msgLabel.text = [NSString stringWithFormat:@"%@ %@",msgModel.singer,msgModel.musicSize]; |
|
|
self.selectImg.image = msgModel.isSelect.boolValue ? [UIImage imageNamed:@"cell_select_Yes"] : [UIImage imageNamed:@"cell_select_No"]; |
|
|
} |
|
|
|
|
|
|
|
|
- (void)subCellView |
|
|
{ |
|
|
UIImageView *selectImg = [UIImageView new]; |
|
|
selectImg.frame = CGRectMake(15, 25, 20, 20); |
|
|
selectImg.image = [UIImage imageNamed:@"cell_select_No"]; |
|
|
self.selectImg.hidden = YES; |
|
|
self.selectImg = selectImg; |
|
|
[self.contentView addSubview:selectImg]; |
|
|
|
|
|
UILabel *nameLabel = [UILabel new]; |
|
|
nameLabel.textColor = [UIColor colorWithRed:81.0/255.0 green:81.0/255.0 blue:81.0/255.0 alpha:1]; |
|
|
nameLabel.textAlignment = NSTextAlignmentLeft; |
|
|
nameLabel.frame = CGRectMake(50, 15, SCREEN_WIDTH-50, 20); |
|
|
nameLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 18]; |
|
|
self.nameLabel = nameLabel; |
|
|
[self.contentView addSubview:nameLabel]; |
|
|
|
|
|
UILabel *msgLabel = [UILabel new]; |
|
|
msgLabel.frame = CGRectMake(50, 40, 230, 20); |
|
|
msgLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 16]; |
|
|
msgLabel.textColor = [UIColor colorWithRed:191.0/255.0 green:191.0/255.0 blue:191.0/255.0 alpha:1]; |
|
|
self.msgLabel = msgLabel; |
|
|
[self.contentView addSubview:msgLabel]; |
|
|
|
|
|
UILabel *numberLabel = [UILabel new]; |
|
|
numberLabel.frame = CGRectMake(0, 0, 50, 70); |
|
|
numberLabel.textAlignment = NSTextAlignmentCenter; |
|
|
numberLabel.font = [UIFont fontWithName:@"HelveticaNeue" size: 16]; |
|
|
numberLabel.textColor = [UIColor colorWithRed:191.0/255.0 green:191.0/255.0 blue:191.0/255.0 alpha:1]; |
|
|
self.numberLabel = numberLabel; |
|
|
[self.contentView addSubview:numberLabel]; |
|
|
} |
|
|
|
|
|
- (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
|
|
|
|