KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm probably missing something obvious here, yet I've been unable to solve the following problem: I have a project with image resources for both normal and retina screens, like someimage.png and someimage@2x.png , which are stored in a separate bundle. When I build the project, Xcode automatically packs them into a single multipage tiff ( imageName.tiff ), I've checked it in finder - it is actually multipage tiff with both images. However, here comes a problem: I struggle to load appropriate resource. What I do is: NSString * imageName = ... ; NSLog(@"imageName: %@", imageName); UIImage * someImage = [UIImage imageNamed: imageName]; Also I fave auxiliary method, which returns bundle with resources: +(NSBundle *) resourcesBundle { NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"MyResourcesBundle" withExtension:@"bundle"]]; return bundle; } I've tried following for imageName : imageName = [[AuxClass resourcesBundle] pathForResource:@"someimage" ofType:@"png"]; in this case i have null for imageName . imageName = [[AuxClass resourcesBundle] pathForResource:@"someimage" ofType:@"tiff"]; in this case actuall image path is returned, however it only works if I use imageWithContentsOfFile instead of imageNamed , and it doesn't take appropriate resource: it loads resource for retina despite the type of screen. If I ommit filetype (as I did before adding @2x resources, and it worked ok, and was the first thing I tried and was sure it would work) imageName = [NSString stringWithFormat: @"%@/%@", @"MyResourcesBundle.bundle"", @"someimage" ]; <p
Tags (comma-separated)
Save Edits
Cancel