Reputation: 36693
In a standard iPhone application, how is the delegate to the UIApplication class identified to the UIApplication? Is it the fact that the delegate identifies itself as following the protocol? Or is there some physical connection?
Upvotes: 1
Views: 81
Reputation: 27597
Two options:
int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, @"MyCustomAppDelegate"); [pool release]; return retVal; }
Upvotes: 1
Reputation: 8759
The connection is created in "Main nib file base base name" xib (NSMainNibFile), as defined in your Info.plist. The UIApplication defined in that xib has a UIApplicationDelegate IBOutlet that will define the delegate to be used.
Upvotes: 1
Reputation: 135558
The connection is made in MainWindow.nib. The UIApplication
instance loads this NIB file and thereby creates the application delegate (which is an object in the NIB) and connects it to its delegate outlet.
Upvotes: 1