Gaojin Hsu Gaojin Hsu - 9 months ago 50
Objective-C Question

How to develop an iOS framework which includes image resources?

I am developing an iOS framework which includes image resources, I call the methods below in the framwork,

crossImage = [UIImage imageNamed:@"cross"];
arrowImage = [UIImage imageNamed:@"arrow"];

and then I build a demo to test my framework, but find crossImage and arrowImage are both nil; Afterwards, I figure out
will search images in the app's directory not in the framework's, so I can fix it by adding the two images to the demo project. However, it's barely elegant. so any other solutions to target the images in my framework?

Answer Source

At last, I create a bundle to hold all image resources, and we provide *.framework and *.bunlde, that's more elegant.