简体   繁体   English

swift 的表格视图中的滑动按钮问题

[英]swipe button issue in tableview in swift

I am using 3 buttons on trailing swipe in a tableview, but when I swipe within the button section then two buttons are gone invisible only one button is visible and action are also trigged automatically.我在表格视图中的尾随滑动时使用了 3 个按钮,但是当我在按钮部分中滑动时,两个按钮不可见,只有一个按钮可见,并且动作也会自动触发。

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
        
        let viewButton = UIContextualAction(style: .normal, title: "") {  (contextualAction, view, boolValue) in
            // View action
            print("View action")
            
        }
        viewButton.backgroundColor = ColorSet.appSkyLightColor
        viewButton.image = UIImage(named: "view")
    
        //Approve
    
        let approveButton = UIContextualAction(style: .normal, title: "") {  (contextualAction, view, boolValue) in
            // approve action
            print("approve action")
            
        }
        approveButton.backgroundColor = ColorSet.appSkyLightColor
        approveButton.image = UIImage(named: "accept")
    
    
        //Reject
    
        let rejectButton = UIContextualAction(style: .normal, title: "") {  (contextualAction, view, boolValue) in
            // Reject action
            print("Reject action")
            
        }
        rejectButton.backgroundColor = ColorSet.appSkyLightColor
        rejectButton.image = UIImage(named: "reject")
        
        let swipeActions = UISwipeActionsConfiguration(actions: [rejectButton, approveButton, viewButton])
        
        return swipeActions
   }

在此处输入图像描述

在此处输入图像描述

swipeActions.performsFirstActionWithFullSwipe = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM