Everything iPhone iPhone Accessory Store iPhone news iPhone accessory reviews iPhone forums


Go Back   iPhone 3G | iPod touch Forums > Apple iPhone Software > Developers

Notices

iPhone versions available: Enhanced | Light



Reply
 
Thread Tools Display Modes
Old 08-20-2008, 06:36 PM   #1 (permalink)
 
Join Date: Oct 2007
Posts: 693
Thanks: 5
Thanked 9 Times in 9 Posts
Default Fast track to dragging and dropping in Interface Builder: - (IBAction)methodName;

That little ditty just saved me a ton of time and made it a cinch to connect the view in Interface Builder to the controller in Xcode. It wasn't entirely obvious until I saw it in one of the project templates and tried to make sense of it myself.

In other words, place this in your ViewController header file (ViewController.h)

Quote:
- (IBAction)methodName;
& draw up your method in the implementation (ViewController.m) like so:

Quote:
- (IBAction)methodName {
doSomething;
}
Save the header and implementation files, then open the respective XIB file. Right-click on a button, slider, or whatever to bring up the list of events it catches (e.g. for buttons, the default is Touch Up Inside). Drag from the circle on the right over to File's Owner in the XIB folder window. It should bring up another little window in which you can select the action you just made. Then whenever that action is performed on the control, your action code will be performed. Also found that right-click-dragging straight from the control in question over to File's Owner will pick that control's most likely desired default event. Note: File's Owner should expect to be set to an instance of your specific ViewController, otherwise it won't know what actions you've made possible in your code. This is how it's set up by default if you pick one of the template applications like Flipside, etc.; but otherwise, you can make sure of it by going to the right-most tab on Inspector, and at the top, give it an appropriate class name to expect.

That was the missing link for me when I tried playing with the earlier betas of the SDK - I couldn't quite figure out how to drag and drop to link things up, and this just saved me a ton of time on a concept UI that I whipped up real quick.

Sorry I don't have screenshots to show at the moment, the computer it's on isn't connected to the net
__________________
8 gig iPhone, no service (jailbroken on 2.1 to activate it as a suped up iPod touch) - 33 applications installed, updated to 2.2

Last edited by fury; 08-20-2008 at 10:58 PM.
fury is offline   Reply With Quote
Reply

Bookmarks

Tags
nda be damned

Thread Tools
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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 06:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Integrated by BBpixel ©2004-2008, jvbPlugin
Android forums

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53