无法在横向模式下打开相机

时间:2013-12-12 11:32:54

标签: ios ipad uiimagepickercontroller

我使用以下代码从我的iPad应用程序打开相机或图库。它只支持横向。

我已经实现了以下代码:

UIImagePickerController *picker=[[UIImagePickerController alloc] init];
picker.delegate=self;
#if TARGET_IPHONE_SIMULATOR
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
#else
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
    picker.showsCameraControls=YES;
   [picker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOff];
#endif
CGAffineTransform transform=picker.view.transform;
transform= CGAffineTransformMakeRotation(-90*M_PI/180);
[picker setCameraViewTransform:transform];
[self presentModalViewController:picker animated:YES];

请帮忙。

0 个答案:

没有答案