Question: I'm developing an app and I have a sing-in/sign-out process. When the user clicks in the sign-out button I want the user to be taken to the home screen. To do this I created the following method in the app delegate:

```
- (void) restartAppWhenLogOut{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    WelcomViewController *welcomeViewController = [[WelcomViewController alloc]init];
    self.navController = [[UINavigationController alloc] initWithRootViewController:welcomeViewController];
    [self.window setRootViewController:navController];
    [self.window makeKeyAndVisible];
}

```

When the user clicks the "Log out" button I call this:

```
[[UIApplication sharedApplication].delegate restartAppWhenLogOut];

```

And it works fine except for one thing. The UINavigationBar is smaller than it should be! Here is an screenshot of how it looks:

![enter image description here](https://i.stack.imgur.com/Z7Hjh.png)

There is an small black line that should be filled by the UINavigationBar...

Any idea why this is happening? 

=======================================Edit=======================================

I removed the new windows creation as `David M.` told me to do in one comment but It still fails: 

```
[self.navController popToRootViewControllerAnimated:NO];
WelcomViewController *welcomeViewController = [[WelcomViewController alloc]init];
self.navController = [[UINavigationController alloc] initWithRootViewController:welcomeViewController];
[self.window setRootViewController:navController];

```

Answer: 
Following `json` advice this is what I did in the `viewDidLoad`of the view controllor with the UINavigationBar problem:

```
[self.navigationController.navigationBar setFrame:CGRectMake(0, 20, 320, 44)];

```

I hope it helps!
Creating a new window is forbidden: ["To change the content your app displays, you can change the window’s root view; you don’t create a new window."](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html) UIKit isn't intended to work that way.