我目前有一个关于iOS 5上的应该AutorotateToInterfaceOrientation的特殊问题。简而言之,我的整个项目应该只处理肖像,除了图像查看器应该处理UIInterfaceOrientationMaskAllButUpsideDown。
基本上,我把这段代码放在我所有的视图控制器中:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation*)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
然后,我有一个名为PageViewController的ViewController。那里有一个按钮可以调用UIImapgePickercontroller。一旦图像被选中,我就会关闭ViewController(imagePicker),所以我回到PageViewController并向前推进ImageViewController。
这给出了:
3
PageViewController -> ImageViewController
1 | A 2
V |
谢谢你的帮助。
图像选取器控制器
发现答案在别的地方。在我的PageViewController中,我正在使用UIPageViewController
。因此,当我拍照时,我会翻一页并使用setViewControllers:direction:animated:completion
将图片添加到另一页。但是,我在调用setViewControllers:direction:animated:completion
并且不使用完成块后立即展示了 ImageViewController。所以我只是在完成块中移动了我的presentViewController:animated:completion:
,它工作得很好。
这里的例子:
[self.pageController setViewControllers:controllersArray direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:^(BOOL finished) {
if (finished)
[self presentViewController:imageController animated:NO completion:nil];
}
希望这会帮助其他人。