在NSTableView OS X中显示rowActions

时间:2016-01-20 10:27:32

标签: macos cocoa swipe nstableview

我想创建一个与IOS中相同的可转换tableview。但我无法找到任何与此相关的文件。此外,我正在浏览NSTableView文档并为以下内容提供资金。

/* View Based TableView: rowActionsVisible can be queried to determine if the "row actions" (see: tableView:rowActionsForRow:edge:) are visible or not. Set rowActionsVisible=NO to hide the row actions. Setting rowActionsVisible=YES is currently not supported and will throw an exception. This property is not encoded in the nib.
 */
@property BOOL rowActionsVisible NS_AVAILABLE_MAC(10_11);

在评论的最后,它说Setting rowActionsVisible=YES is currently not supported and will throw an exception.那么,我们将如何设置行动? 任何线索都会受到赞赏。

1 个答案:

答案 0 :(得分:3)

因此,在MacOS 10.11中添加了新的Swipeable表功能,看起来这样做的方法是通过实现NSTableViewDelegate方法:

optional func tableView(_ tableView: NSTableView, rowActionsForRow row: Int, edge edge: NSTableRowActionEdge) -> [NSTableViewRowAction]

您可以在哪里设置NSTableViewRowAction objects via a relatively straightforward init method