从模态视图启动相机会导致iPad上出现意外调整大小

时间:2012-06-01 00:13:36

标签: objective-c ios xcode cocoa-touch ipad

在我的iPad应用程序中,我创建并调整模式视图,如下所示:

ModalViewController *modalController = [[WishlistInfoViewController alloc] initWithNibName:@"WishlistInfoViewController" bundle:nil];

UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:modalController];
navController.modalPresentationStyle = UIModalPresentationPageSheet; 

self presentViewController:navController animated:YES completion:nil];

navController.view.superview.bounds = CGRectMake(0, 0, 700, 700);
navController.view.superview.center = CGPointMake(self.view.center.x, self.view.center.y + 35);

在该模态视图中,我像这样启动相机:

UIImagePickerController *mypicker = [[UIImagePickerController alloc] init];
mypicker.delegate = self; 
mypicker.allowsEditing = NO; 
mypicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
mypicker.showsCameraControls = YES;
mypicker.wantsFullScreenLayout = YES;
[self.navigationController presentModalViewController:mypicker animated:YES];

我这样关掉相机:

[self dismissModalViewControllerAnimated:TRUE]; 

问题在于,当我关闭相机时,模态视图会调整大小以填满整个屏幕。我该怎么做才能防止模态视图调整大小?

1 个答案:

答案 0 :(得分:1)

好的,所以我解决了我的问题,但只是在调用[self dismissModalViewControllerAnimated:YES]后立即重置了视图的大小。我不知道为什么我直到现在才尝试这个。