NavigationBar not positioned correctly. How to solve this problem?
<p>I have a Navigation Controller in my main view and also subview. And I use the following code to add the navigation view when needed.</p>

<p>In appdelegate.h page</p>

<pre><code>    @interface AapkeappsAppDelegate : NSObject &lt;UIApplicationDelegate, UINavigationControllerDelegate&gt; {
UIWindow *window;
AapkeappsViewController *viewController;
UINavigationController *navigationController; 
}
 @property (nonatomic, retain) IBOutlet UIWindow *window;
 @property (nonatomic, retain) IBOutlet AapkeappsViewController *viewController;
 @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
 @end
</code></pre>

<p>In appdelegate.m</p>

<pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
  (NSDictionary *)launchOptions 
{    
    UINavigationController *nvcontrol =[[UINavigationController alloc]   
               initWithRootViewController:viewController];
[self.window addSubview:viewController.view];
[self.window addSubview:nvcontrol.view];
[window makeKeyAndVisible]; 
return YES;
}
</code></pre>

<p>This code work when press the button </p>

<pre><code>Homepage * rootViewController = [[Homepage alloc] initWithNibName:@"Homepage"   bundle:nil];
    navigationController = [[UINavigationController alloc]  
initWithRootViewController:rootViewController];
    [self.view addSubview:navigationController.view];
</code></pre>

<p>However, the navigation bar is not positioned correctly. I have posted a pic below. Anyone knows what is the potential problem? And how to solve this gap of navigationbar? Help me anyone. Thanks in advance. Here i can post the image. So i have posted a pic in the link <a href="http://i.stack.imgur.com/jxZ7J.png" rel="nofollow">Image</a></p>
