【发布时间】:2013-03-20 10:58:30
【问题描述】:
我正在开发 iPad 应用程序,当我们点击右栏按钮时,我正在执行如下操作:
-(IBAction)camerabuttonAction:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:picker];
[self.popoverController presentPopoverFromRect:CGRectMake(50, -250, 500, 300) inView:appDelegate.splitview.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
我的问题是,当我处于景观模式时,如果我单击按钮。相机以纵向模式显示(图像以反向模式显示)。但是,如果我摇动 iPad,它就会在 LandScape 中显示。
对于 ios6 中的方向,我使用以下方法,但我没有写任何与 UIImagePickerControllerSourceTypeCamera 相关的内容
- (void)viewWillLayoutSubviews
{
if([self interfaceOrientation] == UIInterfaceOrientationPortrait||[self interfaceOrientation] ==UIInterfaceOrientationPortraitUpsideDown)
{
}
else if ([self interfaceOrientation] == UIInterfaceOrientationLandscapeLeft||[self interfaceOrientation] == UIInterfaceOrientationLandscapeRight)
{
}
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationPortrait;
}
【问题讨论】:
标签: iphone ios objective-c uiimagepickercontroller uiinterfaceorientation