2013-11-21 77 views
1

我正在使用iOS 7的應用程序工作。有時,當我打開相機時,我遇到了iOS 6設備中的問題。它凍結在相機快門上。雖然我將ARC設置爲YES。我無法理解問題在哪裏?應用程序在相機快門上死機

我使用的代碼爲這個

self.cameraUI = [[UIImagePickerController alloc] init]; 
self.cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera; 
self.cameraUI.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera]; 

self.cameraUI.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto; 
self.cameraUI.navigationBarHidden = YES; 

self.cameraUI.showsCameraControls = NO; 

self.cameraUI.wantsFullScreenLayout = YES; 
self.cameraUI.delegate = self; 

[self.cameraView addSubview:self.cameraUI.view]; 
+1

我不認爲任何人都可以在沒有看到您的代碼的情況下爲您提供幫助。或者它凍結的部分。 –

+0

好的,我編輯了問題 –

回答

0

你不應該這樣做addSubview:UIImagePickerController的看法。相反,建議您提供UIImagePickerController並實施其代表以獲取選定的圖像。

Apple docs for How to use UIImagePickerController?

呈現用戶界面。在iPhone或iPod touch上,通過調用當前活動視圖控制器的presentViewController:animated:completion:方法,以模式(全屏)方式執行此操作,將已配置的圖像選取器控制器作爲新視圖控制器傳遞。

這是如何從你的控制器提交,

[viewcontrollerObj presentViewController:self.cameraUI animated:YES completion:nil]; 

希望幫助!

+0

感謝您的回覆。但它不起作用,我使用自定義視圖作爲self.cameraView,然後在此視圖上使用相機。 –

+0

@PrachiRajput此代碼無法正常工作? – Amar

+0

正如我所說我正在使用自定義視圖添加相機,根據您的評論,如果有這種類型的問題,它應該每次都會發生。但它有時發生在ios6設備中,而不是iOS 7設備 –