I wanted to know the benefits of creating a static library – will it effect the app load time? .. I needed to know how it works. If I create a library of custom controls would it benefit me in terms of performce and load time?
So if I am creating custom controls e. g. by Graphic context drawing instead of using images would it be beneficial?
E. g. if I am planning to use the minimal number of images and use drawing on context as an option would it be better? What effect would it have on performace?
Static libraries don’t really effect performance. It’s just a way to organize your code differently. You could say that once your code compiles (and links), the resulting app is pretty much identical. Compilation fanatics, please excuse my simplification here 🙂
Working with a static library in iOS has some benefits:
Code re-use. You could share the same library between several of your projects. If you make a change in your library, the change will easily be reflected in all projects once you build them.
You could share your library with others without providing them with a full source. This could be useful if you want to sell your code to other developers.
But, from my experience, a static library has some drawbacks. The main one is that XCode does not handle them very intuitively. It personally took me about a day of work to get my project settings working correctly.. it was quite a hassle.
Regarding the image part of your question.. it’s somewhat unrelated to the static library decision.
Using images mostly costs space (your app is larger to download) and memory consumption. Drawing yourself on the context costs CPU cycles (you actually do the drawing every time the frame is refreshed). In my eyes, the main difference is actually ease of development. In some cases, drawing manually on the context takes more work but you can make changes more easily. Regarding performance, I think images may have a slight advantage but unless you plan to draw some crazy stuff, it’s pretty much negligible. I would decide according to ease of development and not according to performance in this case.