如何在NSViewController中访问复制粘贴功能 [英] How do I access copy paste functionality in NSViewController

查看:48
本文介绍了如何在NSViewController中访问复制粘贴功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在macOS中,我需要在响应者链中的一个 NSViewController 中处理复制粘贴.我发现了对 -copy:sender &的引用Obj-C中的 -paste:sender IBAction方法,但是在我可以使用的Swift 2.3中找不到任何东西.有什么想法吗?

in macOS, I need to handle copy paste in one NSViewController down my responder chain. I have found references to -copy:sender & -paste:sender IBAction methods in Obj-C but can't find anything in swift 2.3 I could use. Any ideas?

推荐答案

您可以将它们保留在视图控制器中,除非响应者链中的其他东西首先将其选中,否则视图控制器应该会获得事件.

You can stick these in your view controller and unless something else in the responder chain picks them up first your view controller should get the events.

@IBAction func copy(_ sender: Any) {

}


@IBAction func paste(_ sender: Any) {

}

这篇关于如何在NSViewController中访问复制粘贴功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆