开发者

iPhone dev: how to load images named the same from different groups

I am working on an iPhone project, and have two themes defined under different directories, with most files share th开发者_如何转开发e same names (like background.png, image1.png, image2.png, etc). I have had them imported into xcode under different group names (group1, group2).

How do I tell UIImage to load an image from a given group, say, I want group1:background.png?

Thanks, Tim


Try this:

NSString *path = [[NSBundle mainBundle] pathForResource:@"image1" ofType:@"png" inDirectory:@"group1"];
[UIImage imageWithContentsOfFile: path];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜