开发者

how to save images to sqlite3 database?

开发者 https://www.devze.com 2023-02-16 10:37 出处:网络
I have an array of UIImages, how to I save them in sq开发者_StackOverflowlite3 database ?@Veer it is upto you you that how you want to save them to the Sqlite database as Parth told you before you hav

I have an array of UIImages, how to I save them in sq开发者_StackOverflowlite3 database ?


@Veer it is upto you you that how you want to save them to the Sqlite database as Parth told you before you have two options have a look on them below

  1. Saving images in the database as BLOB datatype.

  2. Saving images name in the database as String datatype.

Now you have both the options with you........and as you are asking about that you have array of UIImages,and you want to save them in sqlite3 database then i suggest you to choose second one and save the images name by separation of (,) in same field and fetch them accordingly.

Hope you got my point....Good Luck!


For saving images into Sqlite database, there are two options:

FIRST OPTION

You can put your images in Resources folder or may be app's Documents Directory and just save the image names as TEXT datatype in Sqlite.

SECOND OPTION

You can convert your images to NSData format and save it as BLOB datatype in Sqlite.

As such, First option is more feasible, if number of images is more.

Hope this helps you.

0

精彩评论

暂无评论...
验证码 换一张
取 消