【发布时间】:2018-04-12 11:46:13
【问题描述】:
这应该很简单,但我不明白如何实现此操作。
我使用 Objective-c 找到了这个参考,但我想使用 swift 来做到这一点:
- (NSArray<NSTableViewRowAction *> *)tableView:(NSTableView *)tableView rowActionsForRow:(NSInteger)row edge:(NSTableRowActionEdge)edge {
NSTableViewRowAction *action = [NSTableViewRowAction rowActionWithStyle:NSTableViewRowActionStyleDestructive title:@"Delete"
handler:^(NSTableViewRowAction * _Nonnull action, NSInteger row) {
// TODO: You code to delete from your model here.
NSLog(@"Delete");
}];
return @[action];
}
我知道我需要实现该功能但不知道如何实现该方法。 我是 macOS 开发新手,在 App Store 上为 iOS 开发了两个应用程序,我认为将它们移植到 MacOS 会相对简单,我的错误!!
任何帮助表示赞赏。
【问题讨论】:
标签: swift macos nstableview