2013-03-18 86 views
2

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

enter image description here

有應該由UINavigationBar的填充的小黑線...

任何想法,爲什麼發生這種情況?

=======================================編輯====== =================================

我刪除了新的窗口創建爲David M.告訴我做的一個評論,但它仍然失敗:

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

您是否手動設置導航欄? – Chinthaka 2013-03-18 16:15:40

+0

沒有。它「來」與UINavigationController – Andres 2013-03-18 21:01:33

回答

0

json的意見,這是我在做與UINavigationBar的問題的看法controllor的viewDidLoad

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

我希望它能幫助!

1

我試圖找出error..but沒有發現out..so,我建議你嘗試手動設置導航欄..

+0

我也有一個類似的問題一年回來..並通過手動設置解決它... – Shivaay 2013-03-19 06:38:27

相關問題