首页 > 移动平台 > 详细

IOS TableView 去除点击后产生的灰色背景

时间:2015-10-20 18:03:32      阅读:333      评论:0      收藏:0      [点我收藏+]
//重写 cell 点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
    //当离开某行时,让某行的选中状态消失
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

或在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"activityTableViewCell";
    activityTableViewCell *cell = (activityTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *array = [[NSBundle mainBundle] loadNibNamed:@"activityTableViewCell" owner:self options:nil];
        cell = [array objectAtIndex:0];
    }
    cell.activityName.text = [[parkEntity.activity_rows objectAtIndex:indexPath.row] objectForKey:@"title"];
    cell.activityIntroduce.text= [[parkEntity.activity_rows objectAtIndex:indexPath.row] objectForKey:@"description"];
    NSString *imageUrl = [NSString stringWithFormat:@"%@/%@", IMAGE_URL, [[parkEntity.activity_rows objectAtIndex:indexPath.row] objectForKey:@"album_thumb"]];
    cell.activityImage.imageURL=[NSURL URLWithString:imageUrl];
    
    cell.selectionStyle=UITableViewCellSelectionStyleNone;//设置cell点击效果
    
    return cell;
}


IOS TableView 去除点击后产生的灰色背景

原文:http://my.oschina.net/jack088/blog/519412

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!