2015-07-13 39 views
0

我有一個viewController VC1其中I呈現UIImagePickerControllersourceType的相機..然後拍攝照片時,過渡到新的viewController其中使用圖像之後。問題是,我如何解僱imagePicker並無縫轉換到我的新viewController。例如,在我的辭退ImagePickerController並過渡到新的ViewController無縫

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 

方法,我嘗試使用這兩種方法的駁回選擇器並提出新的viewController無縫

[self.presentedViewController presentViewController:postControl animated:NO completion:^{ 
     [picker dismissViewControllerAnimated:NO completion:nil]; 
    }]; 

/* 
[picker dismissViewControllerAnimated:NO completion:^{ 
     [self presentViewController:postControl animated:NO completion:nil]; 
    }]; 
*/ 

顯然,第一個是錯誤的,因爲我要求呈現視圖控制器在其動畫期間解除其自身,導致錯誤。如果我將picker更改爲self.presentingViewController它永遠不會解散相機,並且第二個代碼位(一個註釋)有效,但不是無縫的,換句話說,您可以看到轉換。

對不明白這個問題,但我只是沒有看到它。我如何在推出postControl之後或之前無縫地關閉相機? 就像在你看不到轉變?

回答

1
UIViewController* toPresentViewController = [[UIViewController alloc] init]; 

[picker dismissViewControllerAnimated:YES completion:^ 
{ 
    [self.presentingViewController presentViewController:toPresentViewController animated:YES completion:nil] 
}]; 
+0

這與我的第二種方法(一個註釋掉)有何不同。另外,已經測試過..它不是無縫的。這確實正確工作..因爲我的代碼與評論的文字上面。但是它需要轉換而沒有動畫,並且沒有顯示原始的VC – Chisx

+0

另一種方式是從新視圖控制器的viewDidLoad調用拾取器。 –

+0

這是一個很好的建議 – Chisx