简体   繁体   English

在 iOS 上存储图像

[英]Storing Images on iOS

How to Store Large size Images into iPhone Application?如何将大尺寸图像存储到 iPhone 应用程序中? Images are taken from UIImagePickerController but saving into Database and retrieving from Database crash the application.图像取自 UIImagePickerController 但保存到数据库并从数据库中检索会使应用程序崩溃。

If your images are large enough, then you should NOT store them inside Sqlite.如果您的图像足够大,则不应将它们存储在 Sqlite 中。 Instead, you should simply store in the database the pathname where you actually save the image in the filesystem (say for example the Documents directory of your application).相反,您应该简单地在数据库中存储文件系统中实际保存图像的路径名(例如应用程序的 Documents 目录)。

Now, it is up to you to decide what is large enough.现在,由您决定什么足够大。 To me, binary data greater than 1 megabyte is large enough to decide not to store the data inside the database.对我来说,大于 1 兆字节的二进制数据足以决定不将数据存储在数据库中。 The threshold is dictaed by practical consideration related to the speed of both Sqlite and the filesystem.该阈值由与 Sqlite 和文件系统的速度相关的实际考虑决定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM