2011-04-07 78 views

回答

5

您可以尝试设置单元的selectedBackgroundView.image,按此tutorial。这会给你选择创建一个很好的基于渐变的选择图像。

0
UIImageView *selectedBackground = [[UIImageView alloc] initWithFrame:self.view.frame]; 
     selectedBackground.backgroundColor = [UIColor redColor]; 
     [cell setSelectedBackgroundView:selectedBackground]; 

,你可以尝试这样的事情

3

如果子类的UITableViewCell,你可以通过重写以下方法修改其突出显示,并选择UI行为。

- (void)setSelected:(BOOL)selected animated:(BOOL)animated; 
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; 

例如:

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated 
{ 
    [super setHighlighted:highlighted animated:animated]; 
    if (highlighted) { 
     self.backgroundColor = [UIColor redColor]; 
    } else { 
     self.backgroundColor = [UIColor blackColor]; 
    } 
} 
11

你不需要的图像或子类细胞。简单地做一些事情,如在你的tableView创建单元时注意以下事项的cellForRowAtIndexPath:

  cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:CGRectZero] autorelease]; 
      cell.selectedBackgroundView.backgroundColor = [UIColor redColor]; 
+0

+1,非常解先生:))谢谢 – mAc 2013-07-04 08:08:29

+0

它的工作对我来说..真的很有帮助。 – 2013-12-02 13:46:19