![](/img/trans.png)
[英]How can I set a menu item click to respond to IBAction from another class?
[英]How to connect IBAction and menu item to First Responder?
在Xcode storyboard中,我試圖將ViewAtroller中的IBAction連接到應用程序場景(菜單欄)中的菜單項。
我找到了一個解決方案,告訴我應該將菜單項連接到First Responder。 然后是IBAction的第一響應者,因為First Responder呈現在每個場景上。 因此,First Responder可以首先從菜單欄接收操作,然后將其鏈接到IBAction。
然而,我無法弄清楚如何將菜單項連接到IBAction的First Responder和First Responder。 當我按住Ctrl +拖動菜單項到First Responder時,它只顯示預設動作。 而且我無法在viewController場景上按Ctrl +拖動ViewController到First Responder。
如何將IBAction和菜單項連接到First Responder?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.