如何拍攝照片而無需用戶交互或不呈現ImagePickerController編程方式拍攝照片而無需用戶交互
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
}
// image picker needs a delegate,
[imagePickerController setDelegate:self];
// Place image picker on the screen
[self presentModalViewController:imagePickerController animated:YES];
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
_myImageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
我知道這樣我可以拍照,但自動怎樣做事先 問候 Zohaib完成 謝謝汗
你打算把這個應用程序在App Store嗎?那麼不要... – 2014-08-28 12:12:10
@Anil是否有一些違反AppStore規則? – zohaibkhan 2014-08-28 12:57:17
不要使用'UIImagePickerController',而是用['AVFoundation']寫你自己的相機捕獲(https://developer.apple.com/Library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/04_MediaCapture.html#//apple_ref/DOC/UID/TP40010188-CH5-SW2)。 – rckoenes 2014-08-28 13:04:25