iOS UITableViewCell的集中选择相关的属性

时间:2014-10-13 12:39:20   收藏:0   阅读:577

 

UITableView 中的Cell选中相关的操作:

在TableView中设置Cell相关:

@property(nonatomic) BOOL allowsSelection NS_AVAILABLE_IOS(3_0);  // default is YES. Controls whether rows can be selected when not in editing mode
@property(nonatomic) BOOL allowsMultipleSelection NS_AVAILABLE_IOS(5_0);                 // default is NO. Controls whether multiple rows can be selected simultaneously

 [tableView deselectRowAtIndexPath:indexPath animated:YES];    //已知indexPath更改是否选中


Cell自己相关:

    [cell setUserInteractionEnabled:<#(BOOL)#>];//cell的用户交互
    [cell setSelected:<#(BOOL)#> animated:<#(BOOL)#>];
    [cell setSelectionStyle:<#(UITableViewCellSelectionStyle)#>];

UITableViewCellSelectionStyle:
  UITableViewCellSelectionStyleNone;  无法点击
  UITableViewCellSelectionStyleBlue;   点击是蓝色
  UITableViewCellSelectionStyleGray;   点击是灰色

个人认为,如果说该Cell本身不能被选中则直接在填充时候设置cell的选中状态为UITableViewCellSelectionStyleNone或者setUserInteractionEnabled:NO

 

但是如果说cell中又有自定义的Button,则绝对不能关闭用户交互。就如同imageView默认关闭用户交互一样。(imageView默认关闭用户交互,在imageView中添加Button是无法相应的)

 

原文:http://www.cnblogs.com/madordie/p/4021780.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!