核心思想: 分析视图结构,找到对应ImgView
for (UIControl *control in self.subviews){
if ([control isMemberOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
//找出UITableViewCellEditControl
for (UIView *view in control.subviews)
{
if ([view isKindOfClass: [UIImageView class]]) {
//在UITableViewCellEditControl中找到imageView
UIImageView *img=(UIImageView *)view;
//这样便可以更改按钮的坐标
img.frame = CGRectMake(img.frame.origin.x, img.frame.origin.y, img.frame.size.width, img.frame.size.height);
//更改按钮图片
if (self.selected) {
img.image=[UIImage imageNamed:@"purifier_icon_pressed"];
}else
{
img.image=[UIImage imageNamed:@"purifier_icon_normal"];
}
}
}
}
}