Orientación de cámara en horizontal solo en iphone

In my application I am using camera to take photos, and I want to use a image as overlay on the camera. the camera should show the landscape right only as my application is in landscape right mode. I am adding the UIImagePicker as subview over the view , and i am using the below code to change it to landscape right mode

CGAffineTransform transform=imgPicker.view.transform;
transform=CGAffineTransformRotate(transform, -90*M_PI/180);
transform=CGAffineTransformTranslate(transform, -52, -47);
[imgPicker setCameraViewTransform:transform];

And while I am adding any UIImageView as overlay for the camera, the imageview is not adding as landscape right. its adding in portrait.

Este es mi codigo:

picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
picker.showsCameraControls=NO;

[picker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOff];
[self.view addSubview:picker.view];
picker.view.frame=CGRectMake(0, 0, 480, 320);
picker.cameraOverlayView.frame=picker.view.frame;
CGAffineTransform transform=picker.view.transform;
transform=CGAffineTransformRotate(transform, -90*M_PI/180);
transform=CGAffineTransformTranslate(transform, -52, -47);
[picker setCameraViewTransform:transform];
[picker setWantsFullScreenLayout:YES];
[picker shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
UIView *theView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 120, 120)];
theView.backgroundColor = [UIColor yellowColor];
[picker setCameraOverlayView:theView];

Please tell me where I am doing wrong Thanks in advance

preguntado el 04 de julio de 12 a las 05:07

This is because the default mode for ImageViewPicker Controller is portrait and it is designed to stay in portrait mode only so you cant get it in landscape mode any way as per my knowledge. -

I've created a custom camera and the live screen loads fine in the portrait mode. But when i change it to the landscape mode, i get this error in the console "CGAffineTransformInvert: singular matrix". I tried using autoresizing mask for the orientation change of the live screen, but it isn't helping. I just want the live screen to work both on portrait as well as on the landscape mode. -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.