开发者

UIImagePickerController got white screen after returning from a UIViewController

Here is the situation:

After taking a picture from

[UIImagePickerController takePicture];

The following delegate function :

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

will be called.

Th开发者_开发百科e code inside is

NSLog(@"Photo taken");
UIImage *newImage = [self resizeImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
NSLog(@"Width: %d, Height: %d ",(int)newImage.size.width, (int)newImage.size.height);
//[imagePickerController dismissModalViewControllerAnimated:YES];
ProcessCompleteView *pcv = [[ProcessCompleteView alloc] initWithNibName:@"ProcessCompleteView" bundle:nil];
[imagePickerController presentModalViewController:pcv animated:YES];
[pcv release];

I've called another view to display sth and when I return back from pcv using dismissModalViewController, the area which should display the camera's real-time capture turns white. However, when I dismiss the UIImagePickerController and present it again, the camera works fine!

Anyone can help me on this strange issue??

Thanks.


The order to show view is incorrect.

The correct order is: parent controller's view show -> UIImagePickerController's view show -> UIImagePickerController's view hidden -> ProcessCompleteView show

So, please remove

ProcessCompleteView *pcv = [[ProcessCompleteView alloc] initWithNibName:@"ProcessCompleteView" bundle:nil];
[imagePickerController presentModalViewController:pcv animated:YES];
[pcv release];

into parent controller's viewWillAppear method, and call

ProcessCompleteView *pcv = [[ProcessCompleteView alloc] initWithNibName:@"ProcessCompleteView" bundle:nil];
[parentController presentModalViewController:pcv animated:YES];
[pcv release];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜