I'm having trouble connecting code and Interface Builder

I am having a problem with the iPhone SDK.

I tried to run several tutorials from various sources on my development machine. It seems that the problem is with connecting the code to the view in Interface Builder. If I have a button or data field (or some other library function) and I declare some properties in the file viewcontroller.h, I launch Interface Builder by clicking on the file .xiband trying to make a connection by dragging it out of the link in the connection viewing window and the only possible connection (present in the pop-up window view). No other options are available no matter what code is available. Has anyone experienced this or am I missing something obvious?

+3
source share
4 answers

In your controller header file, make sure that you use IBOutletfor your controls and IBActionfor your methods that you want to link for communication in Interface Builder. Also, make sure your controller class is defined as a “class” for XIB in the Inspector window (owner of aka file)

+5
source

Can you add controls to the interface with code and then associate them with code without using IB?

+1
source

, Interface Builder ? File > Reload All Class Files, .

0

Also make sure that the type of your property matches the type of object you are connecting to. I had the same problem, and it turned out that the Builder interface refused to connect my image to the corresponding property, because this property was UIImage *, not UIImageView *.

If you were just composing a tutorial, your problem might be something else, but it would be easy to enter the wrong property class name, I suppose.

0
source

All Articles