Change default icon for moving cells in UITableView

前端 未结 11 1566
面向向阳花
面向向阳花 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 did this on iOS 12 with swift 4.2

    I hope this helps:

        func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
            for view in cell.subviews {
                if view.self.description.contains("UITableViewCellReorderControl") {
                    for sv in view.subviews {
                        if (sv is UIImageView) {
                            (sv as? UIImageView)?.image = UIImage(named: "your_image")
                            (sv as? UIImageView)?.contentMode = .center
                            sv.frame = CGRect(x: 0, y: 0, width: 25, height: 25)
                        }
                    }
                }
            }
        }
    

提交回复
热议问题