tags:

views:

41

answers:

1

Hi All,

In the MVC design pattern, which class file (appdelegate, viewcontroller etc) is best suited for these IBOutlet/IBAction scenarios?:

  1. IBAction (e.g. Show Menu) to be triggered by UIButton press event?
  2. IBOutlet to manipulate a UI elements properties (e.g. Hide Menu)?

A poke around Apple's sample code seems to show IBOutlets existing in the AppDelegate and/or the ViewController, and IBActions being in the ViewController only.

Any inputs on which way best aligns with the "right way"/MVC design patterns?

Thanks!

+1  A: 

You're going to want both of those things in the View Controller file that is attached to that nib. So if you have a MainMenuViewController.h/.m and MainManuViewController.xib you'll want to put the actions and outlets in there.

The App Delegate you really only want to use to set up some things on launch (like your root views) or do some app-wide actions, like saving or loading data on launch or quit. The outlets in the App Delegate are usually in the MainWindow.xib file, and are for initial app setup.

Cory Imdieke
Thanks, that answers my question.
MrDB