
Untitled
By: a guest on
Jun 21st, 2012 | syntax:
None | size: 0.74 KB | hits: 11 | expires: Never
Why does my custom cell only highlight when the user removes their finger?
- (void)layoutSubviews
{
[super layoutSubviews];
self.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NormalImage"]];
self.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HighlightedImage"]];
// other layout stuff
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
[super setHighlighted:highlighted animated:animated];
if (highlighted) {
self.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"HighlightedImage"]];
} else {
self.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NormalImage"]];
}
}