macos - 在 NSTableView OS X 中显示 rowActions

标签 macos cocoa swipe nstableview

我想创建一个与 IOS 中相同的可滑动表格 View 。但我找不到任何与此相关的文件。我还浏览了 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);

在评论的末尾,它说当前不支持设置 rowActionsVisible=YES,并且会抛出异常。那么,我们将如何设置操作? 任何线索将不胜感激。

最佳答案

因此,MacOS 10.11 中添加了新的可滑动表格功能,看起来实现该功能的方法是通过实现 NSTableViewDelegate 方法:

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

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

关于macos - 在 NSTableView OS X 中显示 rowActions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34897467/

相关文章:

objective-c - 如何将 NSImage 或 NSData 设置为桌面图像?

macos - 在 NSView 中调用 `print` 打开打印对话框

ios - 了解 CATransform3D 围绕所有三个轴的旋转

cocoa - 将 NSMutableArray 转换为 sudzc 中的自定义对象数组

ios - Swift:处理自定义幻灯片菜单中的快速滑动

ios - 使用用户 _www 或守护程序设置 macOS 钥匙串(keychain)搜索列表

objective-c - NSView 中 CALayers 的简单示例

objective-c - 将 CFStringRef 转换为 NSString

WebView Activity 中的 Android 左/右滑动手势(点击链接和垂直滚动)

javascript - 有什么方法可以使 CSS 转换与触摸事件(滑动)同步?