点按某个Cell的时候cell上面的文字高亮或者改变颜色在具体的Cell中重写函数:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
//重写高亮函数
if (highlighted) {
self.textLabel.backgroundColor = [UIColor yellowColor];
self.textLabel.textColor = [UIColor redColor];
self.textLabel.text = [NSString stringWithFormat:@"这是第%ld行 点中我啦哈哈哈",(long)self.tag];
} else {
self.textLabel.backgroundColor = [UIColor clearColor]; self.textLabel.textColor = [UIColor blackColor];
self.textLabel.text = [NSString stringWithFormat:@"这是第%ld行 哈哈哈",(long)self.tag];
}
}
网友评论