S
S
Stanislav Korolevskiy2020-06-10 15:47:42
Swift
Stanislav Korolevskiy, 2020-06-10 15:47:42

How to change cell move icon in TableView edit mode?

Actually I'm trying to change the cell's move icon in the TableView's edit mode. There are very few solutions on the Internet. Found this, BUT it only works after moving any cell. Those. at the start of the edit mode, the custom icon is still displayed.

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 = #imageLiteral(resourceName: "sort") // give here your's new image
        imageView?.contentMode = .center

        imageView?.frame.size.width = cell.bounds.height
        imageView?.frame.size.height = cell.bounds.height
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question