G
G
Gleb Starkov2012-06-13 10:41:44
Objective-C
Gleb Starkov, 2012-06-13 10:41:44

How to link an object with a control in Xcode 4?

I ask for help with programming in Objective C and XCode.
I create an object, associate it with the class, after that I try to link the Button with this object, but it doesn't work.

He recorded his actions on video. (I apologize for the Demo Mode on the video, I've only been working with Mac OS for a week, I recorded the first thing that came to hand)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Gleb Starkov, 2012-06-13
@colonel

Make a method in your Mafoo labeled IBAction. And bind it to performClick: on the button.
arturphoenix

E
eltiren, 2012-06-13
@eltiren

It is not clear what you want to get as a result of this linking

A
arturphoenix, 2012-06-13
@arturphoenix

The desired result is not clear.
If you want the button to become an instance of your MAfoo class, then this class must be inherited from NSButton and in the Identity Inspector change the button class to your MAfoo.
If you want the button to have a link to your object, then for this the button must have a corresponding property of type MAfoo. You can make it so that the button has it in the way described above: by replacing the button class with your own.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question