Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Aug 26, 2008, 04:23 PM   #1
macrumors regular
Join Date: Jul 2008
Location: Huntsville, TX
Interface Builder & XCode

Hi all,

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,
Jerry Smith
dean1012 is offline   0 Reply With Quote
Old Aug 26, 2008, 04:43 PM   #2
macrumors 603
jeremy.king's Avatar
Join Date: Jul 2002
Location: Fox Lake, IL
This is where I am at as well, trying to understand how GUI components communicate with objects.
jeremy.king is offline   0 Reply With Quote
Old Aug 26, 2008, 05:04 PM   #3
macrumors member
Join Date: Jul 2008
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).
Taum is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Learning how to use Xcode / interface builder to program in c/++ furycd001 Mac Programming 6 Sep 20, 2011 04:45 AM
Help With Interface Builder in Xcode Supershane457 Mac Programming 3 Aug 13, 2010 07:19 AM
Interface Builder in Xcode 3.2 jeremyapp Mac Programming 1 Aug 20, 2009 05:38 PM
Walkthrough for Interface Builder and Xcode Monkaaay Mac Programming 3 Mar 29, 2008 02:04 PM
Can someon help me please with Xcode and Interface Builder? markhtfc Mac Programming 21 Jan 31, 2007 06:39 AM

All times are GMT -5. The time now is 11:33 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC