I have a menu like this:

The normal (unselected) state for each cell is the image, the selected state is also an image (it looks like blue by default). However, I would like to add an additional third image, so when the user selects a cell, he briefly changes to this third color before going blue (selected).
This is my code:
(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { [tableView setBackgroundColor:[UIColor clearColor]]; NSString *cellIdentifier = @"MenuItemCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier]; } UIImage *cellBackgroundNormal = [UIImage imageNamed:@"cell_menu_normal"]; UIImage *cellBackgroundSelected = [UIImage imageNamed:@"cell_menu_selected"]; UIImageView *cellBackgroundView = [[UIImageView alloc] initWithImage:cellBackgroundNormal]; UIImageView *cellBackgroundSelectedView = [[UIImageView alloc] initWithImage:cellBackgroundSelected]; cell.backgroundView = cellBackgroundView; cell.selectedBackgroundView = cellBackgroundSelectedView; [cell.textLabel setBackgroundColor:[UIColor clearColor]]; [cell.textLabel setTextColor:[UIColor whiteColor]]; [cell.textLabel setFont:[UIFont boldSystemFontOfSize:17.0]]; cell.textLabel.text = [self.menuItems objectAtIndex:indexPath.row]; return cell; }
As you can see, at the moment I have only two states. I do not see how I can imagine some kind of cell.hoveredBackgroundView for the third image. If anyone can help me realize this, I would really appreciate it.
ios objective-c colors uitableview
swiftcode Apr 28 '13 at 17:30 2013-04-28 17:30
source share