缩进自定义表格视图单元格

我用Storyboard创build了一个自定义的UITableViewCell 。 该单元格包含3个UILabel项目。 当编辑button被击中。 ( – )符号在左侧滑动,但单元格不缩进,( – )符号覆盖UITextLabels之一。

我想知道当编辑button被击中时,使所有3个UITextLabels缩进的最好方法是什么。 我已经尝试将3个标签添加到UIView (contentView),并将其添加到contentsView:

 -(void)layoutSubviews { [super layoutSubviews]; [self.contentView addSubview:self.theContent]; } 

虽然这呈现相同的结果。 有什么build议么?

内容的框架是什么? 你有没有尝试修改框架(从'x'值减去你想要缩进的数量)? 你甚至可以在一个不错的animation中做到这一点:

 [UIView beginAnimations : @"cell edit" context:nil]; [UIView setAnimationDuration:1]; CGRect frame = theContent.frame; frame.origin.x -= 40; // add or subtract here however much you want to indent and in which direction theContent.frame = frame; [UIView commitAnimations]; 

你可以像这样在故事板中设置它。 在这里输入图像说明