Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-21-2008, 09:14 AM   #17 (permalink)
myersn024
Tutorial Author
 
Join Date: May 2008
Posts: 315
Default

If you're wanting to reach the delegate from inside one of your view controllers, then you're going to have to get over being scared of that one line of code. That's how you get the singleton instance of the delegate so you can send messages to it or retrieve data from it.

Say you have a method in your app delegate called flipToBack, and you want to call it from one of your view controllers...this is how you'd do it.

Code:
TwoViewAppAppDelegate *mainDelegate = (TwoViewAppAppDelegate *)[[UIApplication sharedApplication] delegate];
[mainDelegate flipToBack];
That one line of code that you said you were scared of is what makes what you're wanting to do possible. All it does is get a pointer to the instance of your app delegate class. Did you even watch the video, or did you just look at the source? I thought I explained what that line of code did sufficiently.
myersn024 is offline   Reply With Quote
 

» Advertisements
» Online Users: 313
18 members and 295 guests
ADY, BdR, BrianSlick, Diegan, djohnson, Duncan C, F_Bryant, Herbie, ilmman, Joseph Nardone, laurielaptop, M@realobjects, Profile, rob.mccarthy, rodgo, TheWebWizz, VikMyr, yomo710
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,876
Threads: 89,225
Posts: 380,702
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jorge599
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:51 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.