Change default icon for moving cells in UITableView

前端 未结 11 1541
面向向阳花
面向向阳花 2020-11-28 21:46

I need to change default icon for moving cells in UITableView.

This one:

\"enter

11条回答
  •  时光取名叫无心
    2020-11-28 22:22

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
    {
        for (UIControl *control in cell.subviews)
        {       
            if ([control isMemberOfClass:NSClassFromString(@"UITableViewCellReorderControl")] && [control.subviews count] > 0)
            {           
                for (UIControl *someObj in control.subviews)
                {
                    if ([someObj isMemberOfClass:[UIImageView class]])
                    {
                        UIImage *img = [UIImage imageNamed:@"reorder_icon.png"];
                        ((UIImageView*)someObj).frame = CGRectMake(0.0, 0.0, 43.0, 43.0);
                        ((UIImageView*)someObj).image = img;
                    }
                }
            }
        }   
    }
    

提交回复
热议问题