2012-04-17 78 views
0

我有个快速问题。我有一个UITableViewController与自定义单元格具有自定义分隔符(作为UIImageViewcell.contentView的子视图)。现在,当我选择一个单元格时,我想隐藏我的分隔符,以便在突出显示的背景上看不到它。UITableView自定义分隔符,选择时隐藏

我试图用这种结构为:

self.separatorImageViewTop.frame = CGRectMake(-240, 0, 120, 2);   

self.separatorImageViewTop.hidden = YES; 

self.separatorImageViewTop.alpha = 0; 

[self.separatorImageViewTop.frame removeFromSuperview] 

这种方法每个工作,但他们每个人的选定单元格时,正在对自定义分隔闪烁的效果。我怎样才能避免这种闪烁效应?

我的代码是从调用:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 

,但我试着使用:

-(NSIndexPath*)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath 

希望以后tableView:willSelectRowAtIndexPath: method, but the result are the same - still blinking effect of a disapearing UIImageView`会发生电池的实际工作中突出显示。

任何想法?

回答

0

尝试在你的自定义单元格重写此方法:

- (void)setSelected:(BOOL)selected animated:(BOOL)animated 
{ 
    [super setSelected:selected animated:animated]; 

    // Configure the view for the selected state 
}