首页 > 其他 > 详细

UITableViewCell不可以选中

时间:2015-11-16 19:48:26      阅读:204      评论:0      收藏:0      [点我收藏+]

1.把UITableViewCell的SelectionStyle属性设置为:UITableViewCellSelectionNone。

cell.selectionStyle = UITableViewCellSelectionStyleNone;



2.通过UITableViewDelegate的代理方法tableView:willSelectRowAtIndexPath:;如果不希望选中,可以直接返回nil,如果希望选中,可直接返回NSIndexPath;另通过这种方法可以设置部分UITableViewCell可以选中,部分不可以选中

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //可选UITableViewCell
    if (true) {
        return indexPath;
    }
    //不可选UITableViewCell
    return nil;
}



UITableViewCell不可以选中

原文:http://my.oschina.net/simple2012/blog/531015

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