将.xib中的对象连接到现有IBAction [英] Connect object in .xib to existing IBAction

查看:97
本文介绍了将.xib中的对象连接到现有IBAction的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对iOS编程很陌生。

I am quite new to iOS Programming.

这是我的问题:

我想连接现有IBAction方法的新对象。例如,我想按钮执行相同的功能。

I want to connect a new object to an existing IBAction method. For example, I want to buttons to perform the same function.

但是当我控制 - 拖动它时,它总是要求我插入一个新方法。如何添加到现有的?而不是创建新的?

But when I "control-drag" it, it will always ask me to insert as a new method. How can I add to the existing one instead of creating a new one?

XCode中的快照

Snapshot in XCode

推荐答案

xib中编辑器,你可以看到文件的所有者。只需右键单击按钮即可看到黑色弹出窗口,如下图所示。然后将点拖到文件的所有者标签中,然后释放拖动操作。您将看到所有现有 IBAction 的弹出窗口。选择您想要的那个,它将作为选择器添加到您的按钮。您可以根据需要为多个按钮执行此操作。

In your xib editor, you can see the File's Owner. Just right click the button to see the black popup as shown in the image below. Then drag the empty dot to the File's Owner tab and release the drag action. You'll see a popup of all existing IBActions. Select the one you want and it'll be added as a selector to your button. You can do this for as many buttons as you want.

这篇关于将.xib中的对象连接到现有IBAction的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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