Rob*_*Rob 5 iphone objective-c ios
嘿伙计们,我得到一个非常奇怪的错误,我无法弄清楚如何解决它:当我在我的UITableView中滚动时,它有时会突出显示一个蓝色的单元格,即使我没有完全选择.
例如:
-Cell 1-
-Cell 2-
-Cell 3-
-Cell 4-
如果我将手指放在Cell 2上并滚动到Cell 4,它将使Cell 2突出显示,即使didSelectRowAtIndexPath:永远不会被触发.
有任何想法吗?
编辑补充代码:
UITableViewCell *cell = nil;
static NSString *cellId = @"StyleDefault";
cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId] autorelease];
}
cell.textLabel.text = @"Cell One";
cell.textLabel.textAlignment = UITextAlignmentCenter;
[cell setAccessoryView:nil];
return cell;
Run Code Online (Sandbox Code Playgroud)
您可以在创建单元格时使用以下内容。
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = Your allocation.
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Run Code Online (Sandbox Code Playgroud)
我想您还需要查看触摸的 UIViewTable 属性,即延迟内容触摸和可取消内容触摸。
希望这可以帮助。
| 归档时间: |
|
| 查看次数: |
876 次 |
| 最近记录: |