Connect an object in .xib to an existing IBAction

I am very new to iOS programming.

This is my question:

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

But when I "control-drag" it, he will always ask me to insert as a new method. How can I add to an existing, and not create a new one?

Snapshot in Xcode Snapshot in xcode

+4
source share
1 answer

In your xib editor you can see File Owner . Just right-click to see a black pop-up window as shown in the image below. Then drag the blank point to the File Owner tab and release the drag action. You will see a popup of all existing IBAction s. Select the one you want and it will be added as a selector to your button. You can do this for as many buttons as you want.

enter image description here

+7
source

Source: https://habr.com/ru/post/1399629/


All Articles