2012-02-13 68 views
1

尊敬的先生, 在这里,我使用uiimagepickercontroller打开相机,并拍照它ok.But我需要锁定风景模式为uiimagepickercontroller.Here我附上了一些代码线的锁相机在ipad 2的风景模式

UIImagePickerController *imgPkr = [[UIImagePickerController alloc] init]; 
    imgPkr.delegate = self; 
    imgPkr.sourceType = UIImagePickerControllerSourceTypeCamera; 
    imgPkr.cameraDevice=UIImagePickerControllerCameraDeviceFront; 

    imgPkr.cameraOverlayView = anImageView; 
    [theApp.TabViewControllerObject presentModalViewController:imgPkr animated:YES]; 
    [imgPkr release]; 

由于

回答

1

您无法控制UIImagePickerController

使用AVFoundation,你将有处理相机

对于使用AVFoundation的完全控制,看看这个苹果例如

Link

2

子类的UIImagePickerController,和覆盖此方法是这样的:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ 
    return UIInterfaceOrientationIsLandscape(interfaceOrientation); 
} 

然后,而不是创建一个UIImagePickerController,创建您所作的类的对象(您可以命名它,例如UILandscapeImagePickerController),它将只支持景观。

+0

它不适合我的工作,还是其UIImagepicker控制器倾斜在横向模式下 – dineshprasanna 2012-02-13 05:42:43