我的iPad應用程序的工作,有顯示UIImagePickerControllerSourceTypeCamera當我們點擊右邊欄按鈕我給像下面的操作:如何在景觀,而不是Potrait
-(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];
}
我的問題是,當我在如果點擊按鈕,則顯示Land Scape模式。照相機以縱向模式顯示(圖像以反向模式顯示以供查看)。但是,如果我搖動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;
}
在此先感謝
因此,U是說......我必須使用cameraOverlayView,對不對? – Babul 2013-03-20 11:13:00
但是,如果我將我的ipad肖像旋轉到風景,那麼相機會在LandScape @Vincent Saluzzo – Babul 2013-03-20 11:21:55
@Babul中顯示是的,但這是Apple。如果你想要正確並尊重蘋果的推薦,你必須使用'AVFoundation.framework'來做到這一點。 – 2013-03-20 14:25:38