Atm*_*tma 12 iphone uitableview
嗨,我正在尝试让我的uitableviewcell呈现为非活动状态,以便用户无法单击而只是说出单元格中的数据.我尝试这样做:
UITableViewCell *cell = nil;
if (indexPath.row < factsCount) {
static NSString *FactsCellIdentifier = @"FactsCell";
cell = [tableView dequeueReusableCellWithIdentifier:FactsCellIdentifier];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
Run Code Online (Sandbox Code Playgroud)
但是仍然可以单击并突出显示单元格.
谢谢你的帮助!
Jos*_*phH 24
要停止选择某些单元格,请使用:
cell.userInteractionEnabled = NO;
Run Code Online (Sandbox Code Playgroud)
除了阻止选择之外,这还会阻止tableView:didSelectRowAtIndexPath:为设置它的单元格调用.
(但请注意,它将禁用单元格中的任何交互式内容 - 例如.按钮 - 对于这种情况,将selectionStyle设置为UITableViewCellSelectionStyleNone并忽略tableView:didSelectRowAtIndexPath:调用该单元格)
Ole*_*ann 11
将单元格设置selectionStyle
为UITableViewCellSelectionStyleNone
.
归档时间: |
|
查看次数: |
11620 次 |
最近记录: |