Change default icon for moving cells in UITableView

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

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

This one:

\"enter

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 22:26

    Swift 4

       // Change default icon (hamburger) for moving cells in UITableView
        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: "new_hamburger_icon") // give here your's new image
            imageView?.contentMode = .center
    
            imageView?.frame.size.width = cell.bounds.height
            imageView?.frame.size.height = cell.bounds.height
        }
    

提交回复
热议问题