How to save a UIImage to the application's Bundle?

折月煮酒 提交于 2019-12-23 02:40:17

问题


I am currently getting images from the 'Documents' directory (using -imageWithContentsOfFile:) with no problems except that I cannot get the images to display immediately (for example as soon as touchesEnded was called). I am assuming that this has to do with image caching and that image objects created in the above way are not cached? So, I figure, I will cache the image object after creating it and then use the cached image using -imageNamed:. So how can I save a UIImage object to the application's Bundle and/or Cache it?


回答1:


You can't modify the application bundle once it's on the iPhone. The entire thing is code signed, and changing it would cause it to not run any more.

Why don't you pre-load the images you need at startup? Be careful, though, as large images take up a lot of memory, and the kernel could kill your app if it goes overboard.



来源:https://stackoverflow.com/questions/1332437/how-to-save-a-uiimage-to-the-applications-bundle

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