简体   繁体   中英

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 questions 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];

我跳过了使用ABTableViewCell的操作,而是直接将UITableViewCell以及自定义的LayoutSubviews子类化(并让UIKit绘制)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM