开发者

What is the best way to get resource path

开发者 https://www.devze.com 2023-03-12 13:01 出处:网络
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

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 i开发者_开发技巧mage+number.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消