Ian Vink
Ian Vink

Reputation: 68770

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?

Upvotes: 2

Views: 5747

Answers (3)

mm282
mm282

Reputation: 473

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.

Upvotes: 1

Kapil Choubisa
Kapil Choubisa

Reputation: 5232

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

Upvotes: 0

Ilyssis
Ilyssis

Reputation: 4949

You can try this tutorial:

http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

Upvotes: 2

Related Questions