Take a picture in iOS without UIImagePicker and without preview it

后端 未结 4 1285
梦毁少年i
梦毁少年i 2020-12-05 22:25

Do you know any way / method to take a photo in iOS and saving it to camera Roll only with a simple button pressure without showing any preview?

I a

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 22:54

    Set the showsCameraControls-Property to NO.

        poc = [[UIImagePickerController alloc] init];
        [poc setTitle:@"Take a photo."];
        [poc setDelegate:self];
        [poc setSourceType:UIImagePickerControllerSourceTypeCamera];
        poc.showsCameraControls = NO;
    

    You also have to add your own Controls as a custom view on the top of poc.view. But that is very simple and you can add your own UI-style by that way.

    You receive the image-data as usually within the imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:

    To take the photo, you call

    [poc takePicture];
    

    from your custom button.

    Hope, that works for you.

提交回复
热议问题