// // SubTitleCell.m // jiaPei // // Created by apple on 15/11/27. // Copyright (c) 2015年 JCZ. All rights reserved. // #import "SubTitleCell.h" @implementation SubTitleCell - (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 } -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // cfiView = [[CFIView alloc] init]; self.backgroundColor = backGroundColor; // [self.contentView addSubview:cfiView]; [self.imageView setImage:[UIImage imageNamed:@"subject2_standart_icon.png"]]; [self.textLabel setTextColor:kTitleColor]; [self.detailTextLabel setTextColor:contentTextColor]; } return self; } -(void)setIndex:(NSInteger)index{ _index = index; // [cfiView setIndex:index]; } /**每次cell重用时,这里都会调用一次。 切记不要再这里创建视图。 圈圈固定宽高为40. 标题和子标题各占一半。 */ -(void)layoutSubviews { [super layoutSubviews]; CGFloat x,y,w,h; w = h = self.height * .4; x = 20; y = (self.height - h)/2.0; [self.imageView setFrame:CGRectMake(x, y, w, h)]; x = x*2 + w; y = 0; w = self.width - x; h = self.height ; [self.textLabel setFrame:CGRectMake(x, y, w, h)]; // y = self.height * .4; [self.detailTextLabel setFrame:CGRectMake(x, y, w, h)]; } @end