How to save a UIImage to the application's Bun

2019-06-01 12:38发布

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条回答
相关推荐>>
2楼-- · 2019-06-01 12:45

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.

查看更多
登录 后发表回答