• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: More stoopid questions...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More stoopid questions...


  • Subject: Re: More stoopid questions...
  • From: Matt Neuburg <email@hidden>
  • Date: Sun, 14 Nov 2010 07:40:17 -0800

On Sat, 13 Nov 2010 19:35:45 -0600, William Squires <email@hidden> said:
>1) Why is it, when you create a new Cocoa Application (or even some
>iOS Applications) in Xcode, does it generate <blahblah>AppDelegate
>(.h and .m) files, instead of calling them <blahblah>Controller (.h
>and .m)?

It's for your convenience. It used to be that the template *didn't* do this, and this created a bootstrapping problem for everyone who wrote an application, because there was no class in which to put your own code - especially your own code that was to run as the app launched. So the first thing every programmer did was create a class (MyClass), put an instance of it into the main nib (so that there would be a MyClass instance when the app launched and the nib was automatically loaded), and make it the application's delegate (so that it would receive applicationDidLaunch and some code would run).

We all did all those steps manually for years and years, on every single application we wrote. Finally Apple realized they could save us some steps and wrote it into the template. Since the purpose of the provided instance is to function as the app's delegate, Delegate appears in the name.

On iOS there is a further reason - there is an even more serious bootstrap problem. Without some object to run code and make the window key, no interface will appear. So on iOS not only do you get this app delegate instance, you get a line of code already in it that is called at launch (because this instance is the app's delegate, so it receives applicationDidLaunch) to make the window appear.

m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: More stoopid questions...
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: NSUInteger = unsigned int?
  • Next by Date: Three more questions
  • Previous by thread: Re: More stoopid questions...
  • Next by thread: Re: More stoopid questions...
  • Index(es):
    • Date
    • Thread