我正在开发一个应用程序,我有一个登入/注销过程。当用户点击登出按钮时,我想让用户进入主屏幕。要做到这一点,我创建的应用程序代理下面的方法:UINavigationBar小于它必须是
- (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];
}
当用户点击“退出”按钮,我称之为:
[[UIApplication sharedApplication].delegate restartAppWhenLogOut];
,它工作正常,除了一两件事。 UINavigationBar比它应该小!这里是它的外观的截图:
有应该由UINavigationBar的填充的小黑线...
任何想法,为什么发生这种情况?
=======================================编辑====== =================================
我删除了新的窗口创建为David M.
告诉我做的一个评论,但它仍然失败:
[self.navController popToRootViewControllerAnimated:NO];
WelcomViewController *welcomeViewController = [[WelcomViewController alloc]init];
self.navController = [[UINavigationController alloc] initWithRootViewController:welcomeViewController];
[self.window setRootViewController:navController];
您是否手动设置导航栏? – Chinthaka 2013-03-18 16:15:40
没有。它“来”与UINavigationController – Andres 2013-03-18 21:01:33