【发布时间】:2017-03-28 05:24:48
【问题描述】:
当我在编辑模式下滚动表格视图时,我遇到了这个问题。这是因为细胞的可重用性。我跟着链接- UITableView in Edit Mode - Delete Button Dissapears on Scroll
从中一无所获。
这是我的代码 sn-p-
- (void)setEditing:(BOOL)editing
animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[tableView setEditing:editing animated:animated];
[tableView setAllowsMultipleSelectionDuringEditing:editing];
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableview shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
return NO;
}
- (BOOL)tableView:(UITableView *)tableview canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
}
[cell setEditingAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];
cell.textLabel.text=[NSString stringWithFormat:@"%ld",indexPath.row+1];
cell.detailTextLabel.text=@"";
cell.clipsToBounds = YES;
return cell;
}
那么任何人的任何建议或建议如何解决该问题?
谢谢。
【问题讨论】:
-
从哪里可以看到 OP 也面临同样的问题,并且对于同样的问题没有可用的解决方案。
-
@agent_stack 操作?我也在寻找同样的东西。看看有没有人解决了这个问题。
-
OP 表示 原始发帖人 表示是谁发起了讨论,就像这里你是 OP。
-
尝试用强属性声明 tableview 属性...我遇到了这种问题,但当我用强而不是弱更改 tableview 属性时,它工作正常
-
@agent_stack 好的。我用谷歌搜索,发现那个链接有同样的问题。
标签: ios objective-c uitableview