Objective c 从模式视图启动相机会导致iPad上出现不必要的调整大小

Objective c 从模式视图启动相机会导致iPad上出现不必要的调整大小,objective-c,ios,xcode,cocoa-touch,ipad,Objective C,Ios,Xcode,Cocoa Touch,Ipad,在我的iPad应用程序中,我创建并调整模式视图的大小,如下所示: ModalViewController *modalController = [[WishlistInfoViewController alloc] initWithNibName:@"WishlistInfoViewController" bundle:nil]; UINavigationController *navController = [[UINavigationController alloc] initWithRo

在我的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]; 
在该模态视图中,我按如下方式启动相机:

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]; 
我像这样关闭相机:

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]; 

问题是,当我关闭相机时,模式视图的大小将调整为填满整个屏幕。如何防止模式视图调整大小

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

Log.d记录大小的值,并检查它到底在哪里增加,我的意思是在什么点。尝试将此设置为否,mypicker.wantsFullScreenLayout=NO;你在哪里打电话给dismissModalViewController?这可能与您的确切问题无关,但您应该尝试在调用第一个模态视图的视图中始终忽略该问题。您可以使用委托或parentViewController来完成此操作。我尝试了WantFullScreenLayout=NO,但没有任何效果,我尝试从两个视图中删除,但仍然没有任何效果。我确实试着用[self.view.window addSubview:mypicker.view]来调用它,这是可行的,但是我在相机视图中的旋转出现了问题。