需求:自定义的UITableViewCell,在选中cell的时候改变cell内子控件的状态(例颜色和大小)
在自定义的UITableViewCell里面的setSelected写改变状态
-(void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
if (selected == YES) {
self.name_lab.font = font_bold_14;
//[ToolsUtil addGradientToLabel:self.name_lab withColorArr:@[(id)[UIColor colorWithHexString:@"#46AEF7"].CGColor,(id)[UIColor colorWithHexString:@"#1DD5E6"].CGColor]];
[ToolsUtil addGradientToView:self.mul_view withColorArr:@[(id)[UIColor colorWithHexString:@"#46AEF7"].CGColor,(id)[UIColor colorWithHexString:@"#1DD5E6"].CGColor]];
} else {
self.mul_view.backgroundColor = [UIColor clearColor];
self.name_lab.textColor = TYPEFACE_COLOR;
self.name_lab.font = font_of_13;
}
}
网友评论