Programmatically Take Picture Without User Interaction

泪湿孤枕 提交于 2019-12-22 08:42:13

问题


How do I take Picture without User Interaction or without presenting 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"];
}

I know this way I can take picture but automatically How I do accomplish?


回答1:


You can use the takePicture method on UIImagePickerController to take a picture programmaticly.

But I suggest to use AVFoundation to create you onw image capture.



来源:https://stackoverflow.com/questions/25548433/programmatically-take-picture-without-user-interaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!