我的表格视图中有自定义单元格。当 uitable view 处于编辑模式时。圆形的删除图标出现在单元格的内容上。
如何将内容向右移动,以便为那个红色圆形小按钮腾出位置。
在自定义单元格视图 layoutsubview 应该发生一些事情。我应该调整单元格视图的哪个子视图?
提前致谢
请看一下我当前的代码
- (void) layoutSubviews
{
[super layoutSubviews];
CGFloat width = self.width - _productImage.right - 20.f;
if (self.accessoryView)
{
width -= self.accessoryView.width;
}
_productName.width = width;
_productDescription.width = width;
_productPrice.width = width;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:3.0f];
for (UIView *subview in self.subviews) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"]) {
CGRect newFrame = self.contentView.frame;
self.contentView.frame = CGRectMake(40, self.contentView.frame.origin.y, newFrame.size.width, newFrame.size.height);
}
else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellEditControl"]) {
CGRect newFrame = self.contentView.frame;
self.contentView.frame = CGRectMake(40, self.contentView.frame.origin.y, newFrame.size.width, newFrame.size.height);
}
else if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellReorderControl"]) {
CGRect newFrame = self.contentView.frame;
self.contentView.frame = CGRectMake(40, self.contentView.frame.origin.y, newFrame.size.width, newFrame.size.height);
}
}
[UIView commitAnimations];
}