当我在iOS 7中进入UITableView
的编辑模式时,我的单元格内容与删除按钮重叠。
我已经检查了UITableViewCell content overlaps delete button when in editing mode in iOS7个问题但在我的情况下没有用。
我正在动态地在tableView:cellForRowAtIndexPath
方法中创建我的单元格。
如果您对此问题有任何想法,请与我们联系。
答案 0 :(得分:0)
- (void)layoutSubviews
{
[super layoutSubviews];
self.contentView.frame = CGRectMake(0,
self.contentView.frame.origin.y,
self.contentView.frame.size.width,
self.contentView.frame.size.height);
if ((self.editing
&& (_state & UITableViewCellStateShowingDeleteConfirmationMask))){
float indentPoints = self.indentationLevel * self.indentationWidth;
self.contentView.frame = CGRectMake(50,
self.contentView.frame.origin.y,
self.contentView.frame.size.width - indentPoints - 30,
self.contentView.frame.size.height);
}
}
答案 1 :(得分:0)
我实际上使用这个完全实现来使一切看起来很好:
- (void)layoutSubviews
{
[super layoutSubviews];
self.contentView.frame = CGRectMake(0,
self.contentView.frame.origin.y,
self.contentView.frame.size.width,
self.contentView.frame.size.height);
if ((self.editing
&& ((_state & UITableViewCellStateShowingEditControlMask)
&& !(_state & UITableViewCellStateShowingDeleteConfirmationMask))) ||
((_state & UITableViewCellStateShowingEditControlMask)
))
{
float indentPoints = self.indentationLevel * self.indentationWidth;
self.contentView.layer.masksToBounds = YES;
self.contentView.frame = CGRectMake(50,
self.contentView.frame.origin.y,
self.contentView.frame.size.width - indentPoints,
self.contentView.frame.size.height);
}
if ((self.editing
&& (_state & UITableViewCellStateShowingDeleteConfirmationMask)))
{
float indentPoints = self.indentationLevel * self.indentationWidth;
self.contentView.frame = CGRectMake(50,
self.contentView.frame.origin.y,
self.contentView.frame.size.width - indentPoints - 30,
self.contentView.frame.size.height);
}
}
答案 2 :(得分:0)
您可能正在cellForRowAtIndexPath(委托方法)中为Cell设置单元格setBackgroundImage。不要在这里设置。将图像设置为:
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"cellList.png"]]; }