我使用 Storyboard
创建了一个自定义的 UITableViewCell
。该单元格包含 3 个 UILabel
项。当点击编辑按钮时。 (-) 符号在左侧滑入,但单元格没有缩进,并且 (-) 符号覆盖了其中一个 UITextLabel。
我想知道在点击编辑按钮时使所有 3 个 UITextLabels
缩进的最佳方法是什么。我尝试将 3 个标签添加到 UIView
(contentView) 并将其添加到 contentsView:
-(void)layoutSubviews {
[super layoutSubviews];
[self.contentView addSubview:self.theContent];
}
尽管这会呈现相同的结果。有什么建议吗?
最佳答案
内容的框架是什么?您是否尝试过修改框架(从“x”值中减去您希望它缩进的数量)?您甚至可以在漂亮的动画中执行此操作:
[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];
关于ios - 缩进自定义表格 View 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11265963/