Sunday, May 1, 2011

Why do I have to import Quartz Framework, but not Core Graphics Framework?

I have a ViewController class where I use some CG____ structures. There is no import for Core Graphics. So I thought that's fine and tried to start using CALayer without importing Quartz framework. It didn't work, and I hat do import it.

I think I missed the point here why I have to import this one, but not the other one?

From stackoverflow
  • Structures are defined entirely in the headers and thus you only need to #import the proper header to use them.

    To call a function or a method on a class the method needs to be defined in a header and linked at compile time. Importing a framework or library informs the linker which frameworks/libraries to link to.

    Note: it is best to only link to the frameworks you require since adding additional frameworks increases amount of work the loader will have to do.

0 comments:

Post a Comment