我正在開發一個應用程序,我有一個登入/註銷過程。當用戶點擊登出按鈕時,我想讓用戶進入主屏幕。要做到這一點,我創建的應用程序代理下面的方法: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