我在表格 View 中有一些单元格通常是不可选择的。用户必须使用详细信息披露附件来推送包含项目详细信息的新 Controller 。
但是,在返回到 TableView 时,我想突出显示该行,以便清楚他/她来自哪里。为此,我暂时将 selectionStyle 设置为蓝色,选择/取消选择该行,然后将 selectionStyle 设置回无。
但是,因为单元格立即返回到 selectionStyleNone,所以最终结果是灰色的选择/取消选择,而不是蓝色的。
1) 如何将 selectionStyle 的设置延迟到取消选择完成? 2) 在此期间,我的手机将暂时可供快速手指选择 - 我该如何避免这种情况?
最佳答案
您可以使用一个简单的 NSTimer 在设定的时间范围后将选择样式设置为无,如下所示...
[NSTimer scheduledTimerWithTimeInterval:1.0f
target:self
selector:@selector(methodToSetSelectionStyleToNone:)
userInfo:nil
repeats:NO];
...或者您可以使用自定义动画优雅地淡出
[UIView animateWithDuration:1.0f delay: 0.0f
animations:^{
// set your selectionStyleNone here
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
completion:^{
}
];
关于iphone - 暂时使单元格可选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10393443/