This is the situation:
I’ve a viewController that was presented in this way:
AddAttachmentPhotoVideoViewController * addAttachment = [[AddAttachmentPhotoVideoViewController alloc]initWithNibName:nil bundle:nil attachmentType:AtImage];
addAttachment.modalPresentationStyle = UIModalPresentationFormSheet;
addAttachment.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:addAttachment animated:YES];
in addAttachment there is a button that open the camera in this way:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage, nil];
imagePicker.allowsEditing = NO;
imagePicker.showsCameraControls = YES;
imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;
imagePicker.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:imagePicker animated:YES];
The issue is the following: when I rotate the device (iPad) the imagePicker rotates itself but the addAttachment doesn’t rotate; so when I dismiss the picker the addAttachment has a wrong frame and it’s not rotate properly.
In other words, when the camera is shown, the modal view controller under it, doesn’t receive the rotation and so, when I dismiss the picker, the frame of view controller is totally wrong.
Thanks…
You must handle the rotation of your ViewController manually.
The foreground ViewController should propagate the rotation message to all ViewControllers behind of it.