Animated background when selecting ABTableViewCell subclass
I've started implementing a custom subclass of ABTableViewCell. All the cell rendition and so on is going just fine, but when the user selects a row I want it to change to another background color and then back again (as the user releases it) – and I would like it to be animated.
I've found answers to q开发者_StackOverflow中文版uestions how to color the background, but that don't quite do it, as the change of the background color isn't being animated.
Well this will help U,
CGRect a=CGRectMake(0, 0, 300, 100);
UIImageView *bImg=[[UIImageView alloc] initWithFrame:a];
bImg.image=[UIImage imageNamed:@"YourBackGround.png"];
[bImg setContentMode:UIViewContentModeScaleToFill];
cell.selectedBackgroundView=bImg;
[bImg release];
I skipped using ABTableViewCell and instead subclassed UITableViewCell directly along with a custom LayoutSubviews (and let UIKit do the drawing).
精彩评论