Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Custom UITableViewCell Not Responding Properly to setHighlighted

Here's what I need to accomplish:

My UITableView is made up entirely of custom cells.

If a cell is selected the imageView will change.

I need each cell to call setHighlighted so that when a user touches down on the cell they will see the change in the image.

Here's what happens:

The imageView on the cell just flashes. It does not keep the new selected state. so if I touch down, I can see the imageSelected, but when I let go, it stays at imageUnselected.
// this is in my custom cell subclass
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
     [super setHighlighted:highlighted animated:animated];
    
    if (highlighted)
    {
        self.imageView.highlightedImage = [UIImage imageNamed:@imageUnselected];
    }
    else {
        self.imageView.highlightedImage = [UIImage imageNamed:@imageSelected];
    }
}

where should I set just the imageView for the cell? In setSelected?

Replies

Sign In or Register to comment.