为什么UISwipeActionsConfiguration图标超出屏幕范围?

时间:2019-03-12 04:41:06

标签: swift

即使我丢弃了一个滑动动作的图标,最后堆叠的动作也总是超出屏幕范围。 这是我的代码:

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

    let leavedetails = UIContextualAction(style: .normal, title: "LEAVE") { (action, view, nil) in
        print("leave details")
        self.setView(view: self.floatView)
    }


    leavedetails.image = UIImage(named: "leavedetails")
    leavedetails.backgroundColor = UIColor.blue

    let approved = UIContextualAction(style: .normal, title: "APPROVE") { (action, view, nil) in
        print("approved")
    }


    approved.image = UIImage(named: "accept")
    approved.backgroundColor = UIColor.green
    let reject = UIContextualAction(style: .destructive, title: "REJECT") { (action, view, nil) in
        print("reject")
    }
    reject.image = UIImage(named: "reject")
    reject.backgroundColor = UIColor.red


   let config = UISwipeActionsConfiguration(actions: [approved, leavedetails])
    config.performsFirstActionWithFullSwipe = false
    return config
}

链接到图片:https://i.stack.imgur.com/MAjMr.png

0 个答案:

没有答案