UITableViewRowAction title as image icon instead of text

前端 未结 8 1967
谎友^
谎友^ 2020-12-07 22:53

I want put the icon (image) instead of text in swipe actions in tableviewCell in Swift.

But i dont how to put the image instead of title text?

My code is be

8条回答
  •  旧巷少年郎
    2020-12-07 23:14

    Try this

    func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [UITableViewRowAction]? {
    
        let remove = UITableViewRowAction(style: .Default, title: "      ") { action, indexPath in
    
    
            print("delete button tapped")
        }
    
        remove.backgroundColor = UIColor(patternImage: UIImage(named: "Delete")!)
    
        return [remove]
    }
    

提交回复
热议问题