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, 12:45 PM   #18 (permalink)
cDima
New Member
 
Join Date: Aug 2008
Posts: 6
Default

I watched the video, implemented it, I get what you are doing. I'd give you a medal for doing it too.

I may have exaggerated a bit, but let me explain why I don't like that line. The view or view controller in MVC shoudn't know about the TwoViewAppAppDelegate, right?
Because it will never be reusable.

Lets take the UITextView, for example. To send messages UP the view hierarchy, as I understand it, the UITextView defines a prototype called UITextViewDelegate, and a public property called delegate. I believe this is the proper way to create view controllers that send signals to their parents. Right?

So the MVC way of doing that code is:
- define a prototype for the specific ViewController;
- after creating the ViewController in the app delegate, hook the TwoViewAppViewController.delegate to "self" (the app delegate);
- and in the app delegate, implement the prototype;

then from the ViewController you can do this code:

Code:
- (void) someMethod {
    if ([delegate respondsToSelector: @selector(flipToBack)]) {
          [delegate flipToBack]; // do something appropriate
    }
}
...or not? =)
I'm new in all of this, and come from a C# background. Maybe I'm implementing event-based development to make it more familiar.
cDima is offline   Reply With Quote
 

» Advertisements
» Online Users: 272
18 members and 254 guests
ADY, aikhan, AppAnnex, astalavista, chemistry, HemiMG, ilmman, MarkC, mer10, nicko, NSeven, padsoftware, Paul10, pavanindira, Raffaello, sneaky, timle8n1, touchcream
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,877
Threads: 89,219
Posts: 380,707
Top Poster: BrianSlick (7,129)
Welcome to our newest member, peterkessler45
Powered by vBadvanced CMPS v3.1.0

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