Mikayil Abdullayev
Mikayil Abdullayev

Reputation: 12376

What is the best way to get resource path

I wonder what the most common way to get to the resource path and use the resource files is . And how do I group files with the same file types?Lets's say I have 20 images in my resources. But I use half of them for one purpose and the other half for another. Is it the only way to name them so that I can use them by refering to their names, like image+number.

Upvotes: 0

Views: 219

Answers (1)

krzyspmac
krzyspmac

Reputation: 605

When it comes to images I use

[UIImage imageNamed:@"imageName.png"];

this has the advantage of caching images referenced by the same name, but all your images will have to be in "one bag" so to speak.

Some app I saw some time ago grouped it's images (it was a static library) into bundles and then searched for the bundle path using [NSBundle pathForResource...] and added imagePath to that path ([string stringByAddingPathComponent).

As I like simplicity I would got for specific names, like prefixes, to differentiate groups of resources.

Upvotes: 1

Related Questions