所以我的应用在它的左汉堡地下室有一个可编辑和可排序的 UITableView:
为了确保表格单元格足够细以在编辑时显示删除按钮和排序拖动手柄,我创建了一个自定义 UITableViewCell 来处理表格单元格的编辑:
编辑时一切正常,但是当我点击完成时,而不是隐藏删除按钮:
BookmarkTableViewCell.m 中的代码是:
- (void)setEditing:(BOOL)editing animated:(BOOL)animate
{
[super setEditing:editing animated:animate];
if (editing) {
for (UIView * view in self.subviews) {
if([[[view class] description] isEqualToString:@"UITableViewCellReorderControl"])
{
UIView *movedReorderControl = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetMaxX(view.frame), CGRectGetMaxY(view.frame))];
[movedReorderControl addSubview:view];
[self addSubview:movedReorderControl];
CGRect newFrame = movedReorderControl.frame;
newFrame.origin.x = -35;
movedReorderControl.frame = newFrame;
}
}
UIImageView *deleteBtn = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 24, 24)];
[deleteBtn setImage:[UIImage imageNamed:@"icon_delete.png"]];
[self addSubview:deleteBtn];
}
}
如果您需要更多详细信息,请告诉我。任何解决此问题的见解都会很棒。谢谢!