我发现如果您将表视图设置为编辑模式,在删除一行后滚动表格时,单元格编辑控件(左侧的红色减号)位于在您滚动表格时其余单元格的随机状态(旋转垂直或水平)。大概是因为我重用细胞是这样的:UITableView - 在编辑模式下重用单元格
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
我如何可以强制编辑控件是在每个单元的正确的状态?它应该始终处于默认的水平状态,除非我点击它来删除单元格。
编辑:这里的单元代码:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellIdentifier = @"WhateverIdentifier";
MyCell *cell = nil;
//This IF statement fixes the problem, but then I'm not reusing the cells
if (!tableView.isEditing) {
cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
}
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MyCell" owner:self options:nil] objectAtIndex:0];
}
//customize cell
return cell;
}
你能发布你的代码的更多细节? –
发布了该问题的更新。 – soleil
MyCell *类是否有任何自定义的东西? –