2009-11-17 99 views
0

如果我的程序想要使用UIImagePicker(UIImagePickerControllerSourceTypeCamera)來訪問Camera並使用UIImagePickerControllerSourceTypeCamera拍攝照片並回到應用程序,那麼我的程序可以在iPhone上執行此操作,特別是在非越獄設備上? Apple允許這種程序在AppStore中上傳嗎? 我曾經見過某個地方,如果我們創建了這樣的程序,Apple不允許這樣做(從第三方應用程序訪問相機)。是這樣嗎?iPhone:我的程序可以使用imagepicker API訪問相機嗎?

感謝您的建議。

謝謝。

-Prabakar。

+0

http://stackoverflow.com/從屏幕上刪除它,在上面介紹,該模式的情況下問題/ 74113/access-the-camera-with-iphone-sdk – 2009-11-17 19:53:26

+0

我無法理解,爲什麼你不能只使用UIImagePicker?製作照片的標準控制。 – Morion 2009-11-17 19:53:57

回答

1

您使用UIImagePickerController直接:

UIImagePickerController *thePicker = [[UIImagePickerController alloc] init]; 
thePicker.delegate = thePickerDelegate; 
thePicker.sourceType = UIImagePickerControllerSourceTypeCamera; 

//Here you would present thePicker modally, and release it after this 
//It will be deallocated when you remove it from screen 
[anotherViewController presentModalViewController: thePicker animated:NO]; 
[thePicker release]; 

thePickerDelegate,實現

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo; 

image是你拍的照片,和你願意,你可以操縱它。如果你想UIImagePickerController拍攝一張照片後dissapear,這是你會觸發這個動作,並通過調用

[thePicker dismissModalViewControllerAnimated: NO]; 
+0

謝謝。如果我們離開「ThePicker」,這不是泄漏嗎? – Stella 2009-11-17 20:01:39

+0

如果我們把它留在哪裏?請解釋你認爲是泄漏的地方。 – luvieere 2009-11-17 20:06:18

+0

我在問,如果我們像下面那樣分配,我們需要在哪裏釋放'thePicker'?我可以在'didFinishPickingImage'結束時釋放它嗎? UIImagePickerController * thePicker = [[UIImagePickerController alloc] init]; – Stella 2009-11-17 20:07:53

相關問題