Search code examples
iphonedelegateslaunchmainwindow

iPhone Dev - Is it possible to load an app's mainWindow conditionally?


Is it possible to code this sequence of events once an iPhone app has been launched?

  • User launches application.
  • AppDelegate.m checks if data is present in internal database.
  • If yes, MainWindow.xib loads.
  • If no, AnotherViewController.xib loads.

I've only seen app examples that load the MainWindow.xib without conditions.

If it is possible, which method in AppDelegate.m handles the logic? (applicationDidFinishLaunching? viewDidLoad?)


Solution

  • I don't think you want to load the MainWindow conditionally. Instead, load and show a viewController conditionally. This can be done in applicationDidFinishLaunching.