Graphics Programs Reference
In-Depth Information
Build and run your application and then check the output in the log navigator. All you did
was replace what objects you added to the array, and the code runs perfectly fine with a
different output (
Figure 2.15
). Creating this class was a success.
Figure 2.15 Application result
Check out the
#import
statements at the top of
main.m
. Why did you have to import
the class header
BNRItem.h
when you didn't you have to import, say,
NSMutableAr-
ray.h
?
NSMutableArray
comes from the Foundation framework, so it is included
when you import
Foundation/Foundation.h
. On the other hand, your class exists
in its own file, so you have to explicitly import it into
main.m
. Otherwise, the compiler
won't know it exists and will complain loudly.