dineshprasanna
dineshprasanna

Reputation: 1284

Lock Camera in ipad 2 for landscape mode

Respected Sir, Here i am using the uiimagepickercontroller to open the camera and taking the picture its ok.But how i need to lock the landscape mode for uiimagepickercontroller.Here i attached the some code of lines

    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];

Thanks

Upvotes: 0

Views: 867

Answers (2)

Sanjeev Rao
Sanjeev Rao

Reputation: 2307

You can not control UIImagePickerController.

Use AVFoundation, you will have full control on handling the camera

For use of AVFoundation , look this apple example

Link

Upvotes: 1

EmilioPelaez
EmilioPelaez

Reputation: 19922

Subclass UIImagePickerController, and override this method like this:

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

Then, instead of creating a UIImagePickerController, create an object of the class you made (You can name it, for example UILandscapeImagePickerController) and it will support only landscape.

Upvotes: 2

Related Questions