Change default icon for moving cells in UITableView

前端 未结 11 1590
面向向阳花
面向向阳花 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

    I could not get any other answer to work for me, but I found a solution.

    Grzegorz R. Kulesza's answer almost worked for me but I had to make a couple changes.

    This works with Swift 5 and iOS 13:

    // Change default reorder icon in UITableViewCell
    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        let imageView = cell.subviews.first(where: { $0.description.contains("Reorder") })?.subviews.first(where: { $0 is UIImageView }) as? UIImageView
        imageView?.image = UIImage(named: "your_custom_reorder_icon.png")
        let size = cell.bounds.height * 0.6 // scaled for padding between cells
        imageView?.frame.size.width = size
        imageView?.frame.size.height = size
    }
    

提交回复
热议问题