3

I've searched high and low on stackoverflow and google for an answer to this question. Perhaps it's not possible, or I may need to devise a different method to do this.

In our iOS app we have a whole bunch of image sets in images.xcassets. But we're moving to a more dynamic environment where we'll be downloading image sets instead.

I'd like to try and stick with the convention of having everything in the images.xcassets folder. Except as said, I want to dynamically create the image sets based on the data we retrieve from our server. Is this possible?

Salx
  • 579
  • 5
  • 21

2 Answers2

2

So there is a way to do this, but it's iOS 8.0 and above. Unfortunately, we're supporting 7 and above so I can't use it.

But for anyone else who's interested, you can use the UIImageAsset class to do what you need to do when you want to create a container for your images to encapsulate different resolutions, as the images.xcassets container currently does.

UIImageAsset docs

Salx
  • 579
  • 5
  • 21
0

This answer gives a good overview of the XCAssets folder at runtime: Can I access an xcassets directory on the filesystem? - it looks like it's the wrong way of going about things.

I believe it is recommended that you use the temp or document folders, depending on the how long you wish to keep these images (https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html).

Community
  • 1
  • 1
  • Thanks David. I did find a way to do this in iOS 8 as mentioned in my answer above. Thanks for your response. It looks like using the file system may be the way to go for this requirement. – Salx Apr 07 '15 at 17:34