UITableViewCell

1.点击UITableViewCell时,没有点击效果,cellForRowAtIndexPath:方法中写上

cell.selectionStyle = UITableViewCellSelectionStyleNone;

 

2.点击UITableCell时,Cell背景颜色不变,但是上面自定义的控件如:UILabel、UIImageView会变颜色

设置UILabel或UIImageView的Highlighted 然后 在cellForRowAtIndexPath:方法中写上

            UIView *view_bg = [[[UIView alloc]initWithFrame:cell.frame]autorelease];

            view_bg.backgroundColor = [UIColor clearColor];

            cell.selectedBackgroundView = view_bg;

 

3.点击cell行时,背景颜色一闪而过,didSelectRowAtIndexPath:方法中写上

 

[tableView deselectRowAtIndexPath:indexPath animated:NO];

 

4.

点击后,过段时间cell自动取消选中

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

     …………

    //消除cell选择痕迹

    [self performSelector:@selector(deselect) withObject:nil afterDelay:0.5f];

}

- (void)deselect

{

    [self.tableview deselectRowAtIndexPath:[self.tableview indexPathForSelectedRow] animated:YES];

}

posted @ 2013-05-17 21:29  小乐"  阅读(263)  评论(0编辑  收藏  举报