I have looked over the net but didn't find the answer for my situation. So I have a subclass of UITableCellView (I am try to do a cell quite similar to the cells in the Email app). I have added a label on the right side where I want to display a date using a blue color. Now, when I touch the cell, I want to change the color of the label, as the blue highlight will hide it. I have implemented thouchesBegan, Cancelled and Ended, but the problem is that there is some sort of "lag", the cell gets the blue highlight but the label changes its color after a few milliseconds. I am not sure how to change that.
Here is a snippet of my code:
#import "AnnouncementCell.h"
@implementation AnnouncementCell
@synthesize date;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
date=[[UILabel alloc] initWithFrame:CGRectMake(220, 13, 100, 22)];
date.textColor=[UIColor blueColor];
date.font=[UIFont fontWithName:@"Helvetica" size:14.0];
[self addSubview:date];
}
return self;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
date.textColor=[UIColor whiteColor];
[super touchesBegan:touches withEvent:event];
}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
date.textColor=[UIColor blueColor];
[super touchesEnded:touches withEvent:event];
}
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
date.textColor=[UIColor blueColor];
[super touchesCancelled:touches withEvent:event];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end