|Aug 26, 2008, 04:23 PM||#1|
Interface Builder & XCode
I am not having too much trouble creating my interface strictly with XCode. However, I am having a difficult time comprehending how to use Interface Builder. I am positive that if I figure out how, my development process will be tons easier.
I understand how to drag and drop items from the library to a view using Interface Builder. What i'm confused on is how to link objects to code.
What I mean is.... if I drag a button into a view and I have a function in XCode to adds 2 numbers and displays an alert how do I make that function get executed when the button is clicked?
Is the button given an ID accessible by my code and I can access the methods and events of that button to interact with it? Or is there a way in Interface Builder to say "When this button is clicked execute X function"
Thanks in advance,
|Aug 26, 2008, 04:43 PM||#2|
This is where I am at as well, trying to understand how GUI components communicate with objects.
|Aug 26, 2008, 05:04 PM||#3|
Yes, the documentation you linked explains it pretty well.
Basically, you just tag every ivar you want to see in IB with IBOutlet and declare all your actions, then connect everything in IB. When the xib gets loaded, every variable will reference the connected object as you'd expect.
Note that in CocoaTouch, actions can either take 1 parameter (of type id : the sender of the action) or no parameters at all (most of the time you're not interested in which object sent the action).
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Interface Builder WTF.||SolarShane||Mac Programming||2||Mar 12, 2014 02:38 AM|
|Resolved: Can't move objects in Interface Builder||moonman239||iPhone/iPad Programming||0||Jan 13, 2014 07:14 PM|
|Pashua gui tool interface elements anything similar in xcode interface builder||wild4life2013||Mac Programming||1||Aug 10, 2013 08:13 PM|
|OpenGL ES without interface builder?||blueshogun96||iPhone/iPad Programming||1||Feb 10, 2013 01:04 PM|
|Interface Builder Crashes Every Time||wickerman1893||iPhone/iPad Programming||5||Jun 29, 2012 06:57 AM|
All times are GMT -5. The time now is 07:33 PM.