Wolfgang Schreurs
Wolfgang Schreurs

Reputation: 11834

What's the point of the iPad / iPhone app delegates in a universal iOS app?

I've been wondering what i should use these classes for. I would think it's to set up the appropriate main view on the device. By default there's only a dealloc method added to these classes, so I figure I setup my iPhone view in the *AppDelegate_iPhone class in the -init method, yet whatever I do, I'm not able to change the background color or add a subview on the main window using this class. Perhaps I should use this class for other purposes and just use the normal AppDelegate to setup my view hierarchy for each device?

Upvotes: 2

Views: 482

Answers (1)

Tomasz Stanczak
Tomasz Stanczak

Reputation: 13164

You would do stuff common to iPhone and iPad in AppDelegate and the differences in *AppDelegate_iPhone/iPad and inherit AppDelegate. If there are no differences just delete them and change the class of the delegate in both iPhone/iPad main windows to the one and only one AppDelegate.

And init will be the wrong place, IBOutlets will be nil at this place. Put your code inside applicationDidFinishLaunching.

Upvotes: 3

Related Questions