iphone UITableView Custom Cell selected image
I have a custom UITableViewCell which fills the cell with a background PNG and a label.
When the user selected the cell, I wish to have the back ground change for an instant to visually开发者_高级运维 give them indication that the row was selected. Similar to the default behavior when a custom cell is not used.
How is that done?
You can try this tutorial:
http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html
Posting as answer so this is correct (originally from BahaiResearch.com):
In this scenario the correct answer is to use the following, when setting the image originally:
image.HighlightedImage = [UIImage ..];
Otherwise you are loading images when the highlight event occurs and in theory there's a slight delay, etc.
let me clear first do you wish to change the backgroundimage.png??
if yes and you are using UIImageView for that then you can write following code in rowDidSelected event..
UIImageView *myImageView = [Cell viewWithTag:1]; //Tag is given in Interface Builder for the ImageView
myImageView.image = [[UIImage alloc] imageNamed:@"newimage.png"];
精彩评论