The key difference between library and framework is the inversion of control. In case of library the user code calls the library code whereas in case of framework the framework code calls the user code. Frameworks can internally call library code. The pic below explains it (courtesy: http://stackoverflow.com/a/15600924).
Basically framework contains all the wired up skeleton code and user code just need to fill up the skeleton.