How to take a picture and save in SQLite database on iOS

后端 未结 3 925
小蘑菇
小蘑菇 2021-02-06 19:33

I have a camera application in which when I click on the camera button the camera opens and user can take picture from camera or from photo-library.

I have done the came

3条回答
  •  粉色の甜心
    2021-02-06 20:00

    If you are using the UIImagePickerController, you can get the image in its imagePickerController:didFinishPickingMediaWithInfo: delegate method. The image you get is an UIImage object.

    UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
    NSData *data = UIImageJPEGRepresentation(image, 1.0);
    

    Now NSData has a method bytes which returns void*. This will point to a C type array which should play well with SQLite.

提交回复
热议问题