// // CYActiveTieleTableViewCell.m // shiku_im // // Created by Ron on 2019/11/14. // Copyright © 2019 Reese. All rights reserved. // #import "CYActiveTieleTableViewCell.h" @implementation CYActiveTieleTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake( 20, 10, 200, 20)]; title.font = [UIFont systemFontOfSize:16.0]; // [self.contentView addSubview:title]; _title = title; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH- 40, 13, 20, 20)]; // imageView.layer.cornerRadius = 50 / 2; imageView.layer.masksToBounds = YES; [self.contentView addSubview:imageView]; imageView.image = [UIImage imageNamed:@"set_list_next"]; _imageV = imageView; UILabel *subtitle = [[UILabel alloc] initWithFrame:CGRectMake( imageView.frame.origin.x - 10 - 50, 10, 50, 20)]; subtitle.backgroundColor = [UIColor colorWithRed:31/255.0 green:160/255.0 blue:211/255.0 alpha:1]; subtitle.layer.masksToBounds = YES; subtitle.layer.cornerRadius = 10; subtitle.textColor = UIColor.whiteColor; subtitle.textAlignment = NSTextAlignmentCenter; subtitle.font = [UIFont systemFontOfSize:16.0]; // [self.contentView addSubview:title]; _subtitle = subtitle; UIView *lineView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 39.5, JX_SCREEN_WIDTH, .5)]; lineView2.backgroundColor = HEXCOLOR(0xdcdcdc); [self.contentView addSubview:lineView2]; [self.contentView addSubview:_imageV]; [self.contentView addSubview:_title]; [self.contentView addSubview:_subtitle]; // UILabel *subTitle = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(imageView.frame) + 10, CGRectGetMaxY(title.frame) + 7, JX_SCREEN_WIDTH - 65 - (CGRectGetMaxX(imageView.frame) + 10) - 10, 20)]; // subTitle.font = [UIFont systemFontOfSize:14.0]; // subTitle.textColor = [UIColor lightGrayColor]; // [self.contentView addSubview:subTitle]; // _subTitle = subTitle; // // UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH - 65, 20, 50, 24)]; // btn.backgroundColor = THEMECOLOR; // [btn setTitle:@"添加" forState:UIControlStateNormal]; // [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; // btn.titleLabel.font = [UIFont systemFontOfSize:15.0]; // btn.layer.cornerRadius = 3.0; // btn.layer.masksToBounds = YES; // btn.tag = self.tag; // [btn addTarget:self action:@selector(onAdd:) forControlEvents:UIControlEventTouchUpInside]; // [self.contentView addSubview:btn]; // _addBtn = btn; } return self; } - (void)setSubtitleText:(NSString *)subtitleText { _subtitleText = subtitleText; // 根据字体得到NSString的尺寸 CGSize size = [subtitleText sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16.0],NSFontAttributeName,nil]]; _subtitle.frame = CGRectMake(_imageV.frame.origin.x - 10 - size.width -10, 10, size.width + 10, 20); _subtitle.text = subtitleText; } - (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