2013-01-09 126 views
0

這是設置:我有一個UIViewController其中UITableView在其中。當其中一個單元格被觸摸時,會出現一個操作表單,提供從庫中選擇照片或拍攝新照片的選項。在任一情況下,我顯示UIImagePickerController像這樣:UINavigation控制檯彈出標題,但不是控制器

在我的接口聲明

UIImagePickerController* imageController; 
在viewDidLoad中

imageController = [[UIImagePickerController alloc] init]; 
imageController.delegate = self; 
imageController.allowsEditing = YES; 
在我的動作片委託方法

if(buttonIndex == 2) 
    return; 

UIImagePickerControllerSourceType sourceType = UIImagePickerControllerSourceTypeCamera; 

if(buttonIndex == 1) 
    sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 

imageController.sourceType = sourceType; 

[self presentModalViewController:imageController animated:YES]; 

即工作正常,圖像選擇器得到顯示。然而,從這一點上,導航控制器似乎不能正常工作。我可以撥打

[self.navigationController popViewControllerAnimated:YES]; 

並且導航欄中的標題將隨標準彈出式動畫更改,但控制器本身不會消失。這隻發生在圖像採集器控制器顯示之後。我可以在顯示控制器之前取消操作表,並且根本沒有任何問題。

我已經包含一個鏈接到一個短視頻,因爲這個應用程序已經生活 - 這只是一個重新構建。

http://screencast.com/t/qBolp2v3iCyR

我試圖顯示從導航控制器和標籤欄控制器的模態 - 相同的結果。我已經使用這種呼叫嘗試替代顯示方法:

[self presentViewController:imageController animated:YES completion:^{}]; 

我已驗證我的導航控制器不是nil,以及適當的控制器,是在堆棧中。任何幫助將非常感激。提前致謝。

+0

檢查你的代碼,你正在推動viewcontroller.May是問題是有 –

+0

沒什麼奇怪的,當我推棧上的控制器。我打電話給[self performSegueWithIdentifier:@「SegueName」sender:self]。我的prepareForSegue方法並不複雜,只是在目標控制器上設置值。 –

+0

我也只是嘗試評論prepareForSegue方法中的所有內容,它仍然在發生。 –

回答

0

試試這個, 如果你

[self presentModalViewController:imageController animated:YES]; 

您必須dismissView與

[imageController dismissViewControllerAnimated:YES completion:nil]; 

顯示的viewController因爲popViewController時將使用的顯示視圖與pushViewController

對不起我的英語不好。

+0

感謝您的建議,但我仍然有同樣的問題。 –

0

要關閉控制器使用presentModalViewController:animated:加入,你應該使用

[self.navigationController dismissModalViewControllerAnimated:YES] 
+0

我只是試過這個,我仍然有同樣的問題。不過謝謝。 –