1

I'm learning Objective-C, and I have to do one app. What I'm trying to do, is call from my MainViewController, a SplitViewController, in code. That's already solved. Now, I have to call multiple DetailViewControllers. I've found this example:
http://kshitizghimire.com.np/uisplitviewcontroller-multipledetailviews-with-navigation-controller/

In this example, they use MultipleDetailViewsWithNavigatorAppDelegate to declare SplitViewController and MasterViewController, because the SplitViewController is loaded from the start, in the first ViewController, and using the didFinishLaunching function, of the AppDelegate. In my app, I'm loading the SplitViewController in the second ViewController, so my SplitViewController is declared and loaded in my ViewController, not in my AppDelegate. I've read, that "delegates" are like Interfaces, to declare and implement methods in different way, but here there are not using protocols or delegate methods. So, I have to do other AppDelegate for my SecondViewController, and declare in this new AppDelegate the SplitViewController and MasterViewController?... Or is this AppDelegate variable reference, just to reference to SplitViewController?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1600801
  • 269
  • 7
  • 25
  • Read this: http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AppArchitecture/AppArchitecture.html#//apple_ref/doc/uid/TP40007072-CH3-SW2 – Carl Veazey Aug 31 '12 at 06:59

1 Answers1

3

From Cocoa Core Competencies:

Delegation is a simple and powerful pattern in which one object in a program acts on behalf of, or in coordination with, another object. The delegating object keeps a reference to the other object—the delegate—and at the appropriate time sends a message to it. The message informs the delegate of an event that the delegating object is about to handle or has just handled. The delegate may respond to the message by updating the appearance or state of itself or other objects in the application, and in some cases it can return a value that affects how an impending event is handled. The main value of delegation is that it allows you to easily customize the behavior of several objects in one central object.

Adam
  • 26,549
  • 8
  • 62
  • 79
  • Thank you very much. So, do I have to have an AppDelegate for every ViewController? and change my "delegate" every time I'm changing my view so this way to pass the control to my new ViewController? – user1600801 Aug 31 '12 at 15:28