views:

54

answers:

4

I am trying to make a static library similar to what PayPal has done (https://www.x.com/community/ppx/xspaces/mobile/mep) for the iPhone.

It looks like PayPal is able to integrate views into the library as well as image resources. The only solution I can think of is to code the UI by hand for the UI and produce binary data for the image resources. Both of these seem very ugly to me. Any other ideas on how to incorporate UI and image resources into a static library?

A: 

I'm fairly certain you can store images in JAR files (the android library seen there), and im positive you can do the same for iphone stuff also, many programs (I know the emulator PCSX2 does) store small images withing the source

KageUrufu
+1  A: 

The answer is to simply ship the resources separately from the static library. For convenience you may want to package them as a bundle. Then, the user of your library simply adds the static library and the bundle to their project.

Luke Redpath
That's actually not the answer at all since that is not what PayPal is doing. That does work if you want to do something similar, but then the developer has to remember to include the bundle (which is not that big of a hardship).
Kendall Helmstetter Gelner
How is not an answer? The simple fact is: you cannot include resources in a static library. The question was "Any other ideas on how to incorporate UI and image resources into a static library?"I provided one. yes, having to include the bundle is slightly inconvenient but not overly so.
Luke Redpath
+2  A: 

If you lipo -thin and ar -t PayPal's library you can see that there is nothing but .o files in the library. They are either getting the images from the internet or encoding and compiling them as C arrays.

cobbal
Thank you. I don't know lipo very well. This is very helpful and yes I think pulling it from the Internet is also another possibility.
Shiun
I did a quick test where I disabled my internet connection and attempted to run the sample app that utilizes the PayPal SDK and the SDK refused to load further supporting that the art assets could very well be pulled from the Internet. Though there's a possibility that it just disables itself too if there is no Internet connection. But I'm definitely leaning toward thinking that the image resources are stored on their servers.
Shiun
A: 

It is also possible they are simply drawing the images with Quartz2D. The drawing program Opacity can output Quartz2D code in addition to other image formats:

http://likethought.com/opacity/

Kendall Helmstetter Gelner