自定义tableViewCell,并在.m 文件执行以下代码
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *subView in self.subviews) {
if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
// 拿到subView之后再获取子控件
UIView *deleteConfirmationView = subView.subviews[0];
for (UIView *deleteView in deleteConfirmationView.subviews) {
UIImageView *deleteImage = [[UIImageView alloc] init];
deleteImage.contentMode = UIViewContentModeScaleAspectFit;
//Delete为图片
deleteImage.image = [UIImage imageNamed:@"Delete"];
deleteImage.frame = CGRectMake(0, 0, deleteView.frame.size.width, deleteView.frame.size.height);
[deleteView addSubview:deleteImage];
}
}
}
}