views:

495

answers:

1

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?

+1  A: 

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.

rpetrich