How to do custom font and color in UITableViewRowAction without Storyboard

前端 未结 9 1815
失恋的感觉
失恋的感觉 2020-12-30 08:09

I have classic TableView where you can delete item if you swipe and than clicking on the button. I know how to set custom background on the cell, but I can\'t find how I can

9条回答
  •  天命终不由人
    2020-12-30 09:07

    //The following code is in Swift3.1
        func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?
        {
            let rejectAction = TableViewRowAction(style: UITableViewRowActionStyle.default, title: "\u{2715}\nReject") { action, indexPath in
                    print("didtapReject")
                }
                rejectAction.backgroundColor = UIColor.gray
                let approveAction = TableViewRowAction(style: UITableViewRowActionStyle.default, title: "\u{2713}\nApprove") { action, indexPath in
                    print("didtapApprove")
                }
                approveAction.backgroundColor = UIColor.orange
                return [rejectAction, approveAction]
           }
    

提交回复
热议问题