I’ve got a particular issue at the moment concerning shouldAutorotateToInterfaceOrientation on iOS 5. To put it simply, my whole project is supposed to handle Portrait only, except for the image viewer which should handle UIInterfaceOrientationMaskAllButUpsideDown.
Basically, I put this code in all of my viewControllers :
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation*)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Then, I’ve got a ViewController called PageViewController. There is a button there that invokes an UIImapgePickercontroller. And once the image is picked, I dismissViewController (the imagePicker), so I get back to PageViewController and I push forward the ImageViewController.
Which gives :
3
PageViewController -> ImageViewController
1 | A 2
V |
Thanks for you help.
ImagePickerController
Found out the answer was laid somewhere else.
In my PageViewController, I’m using a
UIPageViewController. So when I take a picture, I turn a page and add the picture to that other page usingsetViewControllers:direction:animated:completion. However, I presented the ImageViewController right after callingsetViewControllers:direction:animated:completionand not using the completion block. So I just moved mypresentViewController:animated:completion:in the completion block and it worked just fine.example here :
Hope this will help someone else.