2012-05-30 5 views
5

私のアプリでは正面カメラのみを使用します。そこで以下のコードを実装しました。UIImageViewController cameraDeviceはカメラが開くたびに使用されません。

if ([UIImagePickerControllerisCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]) { 
    self.imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront; 
} 

これは、初めてカメラを開くとき(前面に向いているカメラを使用しているとき)に機能します。しかし、写真をキャンセルしてカメラに再入力すると、リアカメラを使用しています。それぞれに

は解除/再入力し、それはフロントとリアのカメラを切り替えカメラに...

私が行方不明です何かはありますか?

答えて

0
Tr this code .I used this code and it is working fine .Use this code either in button action or viewwillappear or viewdidload and dismiss the camera view properly 
    imgPicker =[[UIImagePickerController alloc] init]; 
    imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
    imgPicker.cameraDevice=UIImagePickerControllerCameraDeviceFront; 
    imgPicker.showsCameraControls = YES; 
    imgPicker.allowsEditing = YES; 
    imgPicker.delegate=self; 
    [self presentViewController:imgPicker 
         animated:NO completion:nil]; 
+0

は魅力的に機能します – Ruban

0

私は同じ問題を抱えて、ここで示したようにUIImagePickerControllerを割り当てるための呼び出しに自動解放を含めることによって、私の場合は、問題を解決した

UIImagePickerController * cameraUI = [[[UIImagePickerControllerのalloc]のinit] autoreleaseの]。

+1

私はARCを使用しているので、私は自動解除できません。 – TrentEllingsen

関連する問題