在用- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath方法实现重排时,有一个三条线的默认图片,下面的方法可以实线替换默认图片
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
for (UIView *viewin cell.subviews) {
if ([[[viewclass] description]isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *vin view.subviews) {
if ([visKindOfClass:[UIImageViewclass]]) {
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageViewalloc]initWithFrame:CGRectMake(5,5, 35,35)];
imageView.image = [UIImageimageNamed:@"change.png"];
[view addSubview:imageView];
}
}
}
或者在自定义的cell的m文件中添加如下方法
- (void)layoutSubviews{
[super layoutSubviews];
for (UIView *view in self.subviews) {
if ([[[view class] description] isEqualToString:@"UITableViewCellReorderControl"]) {
for (UIView *v in view.subviews) {
if ([v isKindOfClass:[UIImageView class]]) {
[v removeFromSuperview];
}
}
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 35, 35)];
imageView.image = [UIImage imageNamed:@"change.png"];
[view addSubview:imageView];
}
}
}