Graphics Reference
In-Depth Information
the desktop. In subsequent chapters, you learn about all the different aspects of Core
Animation, and we try to discuss the differences that are relevant to the iPhone where it
makes sense to do so. In some of the layer-specific chapters, we don't discuss the iPhone
because these layers are not yet available for the iPhone.
Notes on Sample Projects
All the sample projects we provide in this topic have a main application delegate class. In
the case of sample code on OS X, we create an application delegate class that we always
name AppDelegate . In iPhone projects, the project template automatically creates an
application delegate class named using
the format <project_name> AppDelegate ,
in which <project_name> is the name
you give your project.
NOTE
If you use Xcode 3.2 or later, the project
template automatically creates an applica-
tion delegate for OS X projects the same way
it does for iPhone projects. If you use
anything earlier, however, you need to use
the steps in the next section to set up your
own AppDelegate class.
On OS X, the majority of the code is
placed in the AppDelegate class. On the
iPhone, the majority of the code is
placed in the view controller class for
the view being developed, whereas the
application delegate class provides basic
setup and boostrapping of the application. It's a subtle difference, although an important
one.
Setting Up Xcode Projects for OS X (Xcode 3.1 and Earlier)
When you create a new project in Xcode 3.1 or earlier for OS X development, the project
template does not automatically create the application delegate class for you as it does in
iPhone projects or OS X projects in Xcode 3.2 and later. Adding one is not difficult, but
you need to know how to do it if you set up your own projects from scratch rather than
simply relying on the sample code. When you create a project for OS X development, use
the following steps to add an application delegate and the QuartzCore framework, the
framework that provides the Core Animation classes.
1. In Xcode, press Shift-
-N and select Cocoa Application in the Project Templates
dialog.
2. Name the project and click Save.
3. Expand the Frameworks group, Control-click the Linked Frameworks subgroup, and
select Add > Existing Frameworks .
4. In the resulting dialog, navigate to /System/Library/Frameworks and select
QuartzCore.framework . Click Add and then Add again when prompted.
5. Control-click the Classes group and select Add > New File .
6. In the New File template dialog, select Objective-C class under the Cocoa group
and click Next.
 
Search WWH ::




Custom Search