title: difference between appdelegate and delegate in viewcontroller
body: <p>I want to integrate one sample code with (for example SampleCode project) my iPhone application .In the sample code in firstViewController is added in MainWindow.xib and linked to <code>viewController</code> created in the below code.</p>
  
  <pre><code>@interface SampleCodeAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
      UIWindow *window;
      firstViewController *viewController;
  }
  
  @property (nonatomic, retain) IBOutlet UIWindow *window;
  @property (nonatomic, retain) IBOutlet firstViewController *viewController;
  </code></pre>
  
  <p>and viewController instantiated with initWithCoder and when firstView is appeared on tap of button Camera can be opened be calling OpenCamera method as in the below code.</p>
  
  <pre><code>//in firstViewController.mm file
  
  - (id)initWithCoder:(NSCoder *)coder {
  
      if (self = [super initWithCoder:coder]) {
  
      }
  
      [self initLocal];
  
      return self;
  }
  //to open camera in SampleCode application
      - (IBAction)OpenCamera {
  
          UIApplication *app = [UIApplication sharedApplication];
          SampleCodeAppDelegate* delegate = [app delegate];
          UIViewController* uiViewCont = [delegate viewController];
          ((CCamera*)m_pCamera)-&gt;Camera(uiViewCont);
      }
  </code></pre>
  
  <p>In my navigation based application (MyApplication) I want to call firstViewController of SampleCode with one of viewController MyApplicationViewControllerA directly without adding to MyApplicationAppDelegate.</p>
  
  <p>So I want to if I am creating the delegate in MyApplicationViewControllerA viewController that should work as the appdelegate in SampleCode application.
  I am not able to open the camera but after closing the camera I am not able to open any other view of  MyApplication except MyApplicationViewControllerA. 
  I am trying pushViewController and modalViewController not able to render other View.</p>
  
  <p>I am not confused about the delegate. So I want to know what is the difference between AppDelegate(in <code>SampleCodeAppDelegate : NSObject &lt;UIApplicationDelegate&gt;</code>) and delegate declared in other ViewContrller.</p>