Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa NSTableViewRowAction-单击后向后滑动_Cocoa_Swift4_Nstableview_Xcode10_Macos Mojave - Fatal编程技术网

Cocoa NSTableViewRowAction-单击后向后滑动

Cocoa NSTableViewRowAction-单击后向后滑动,cocoa,swift4,nstableview,xcode10,macos-mojave,Cocoa,Swift4,Nstableview,Xcode10,Macos Mojave,我使用tableView(uquo:rowActionsError:edge:)->[NSTableViewRowAction]向我的表视图添加了一个幻灯片功能,但我发现当我单击前导按钮时,它工作正常,但它不会向后滑动 这是“我的行”操作的代码: extension ViewController: NSTableViewDelegate { func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge:

我使用
tableView(uquo:rowActionsError:edge:)->[NSTableViewRowAction]
向我的表视图添加了一个幻灯片功能,但我发现当我单击前导按钮时,它工作正常,但它不会向后滑动

这是“我的行”操作的代码:

extension ViewController: NSTableViewDelegate {
    func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge: NSTableView.RowActionEdge) -> [NSTableViewRowAction] {
        // some other codes
        switch edge {
        case .trailing:
            // some other codes
        case .leading:
            let revealInFinderAction = NSTableViewRowAction(style: .regular, title: "Reveal in Finder") { (action, row) in
                self.revealInFinder(row: row)
            }
            revealInFinderAction.backgroundColor = .systemOrange
            return [revealInFinderAction]
        }
    }
}
例如,我的一个按钮执行“在查找器中显示”作业(
RevealingFinderAction
),单击按钮后,它在查找器中显示文件,但没有向后滑动

我发现苹果的邮件应用程序可以完美地处理这个问题,在滑动其中一个单元格后单击标记为已读/未读按钮,它完成了它的工作并自动向后滑动。我只是想找到一种方法让同样的事情发生


我已经研究过如何实现这一点,但我找不到解决方案,请问有人能帮我吗?我正在macOS 10.14上使用Xcode 10和Swift 4。

尝试设置
tableView.rowActionsVisible=false
,如下所示:

case .leading:
        let revealInFinderAction = NSTableViewRowAction(style: .regular, title: "Reveal in Finder") { (action, row) in
            self.revealInFinder(row: row)
            tableView.rowActionsVisible = false
        }
        revealInFinderAction.backgroundColor = .systemOrange
        return [revealInFinderAction]