Game Development Reference
Cocos2d and UIKit Views
For most iOS developers there's a clear dividing line: if you want to program “regular”
apps with no or little multimedia content, you'll be using Cocoa Touch and its UIKit
framework to create the iPhone's and iPad's native user interfaces.
But if you want to develop iOS games and multimedia applications, you want to use
cocos2d and have little incentive to use anything but CCSprite and CCMenu to create
your game's scenes and user interfaces.
A great number of developers are experienced only in either environment, and they of-
ten find it confusing to cross the border from Cocoa Touch to cocos2d and vice versa. In
almost all these cases, the programmers want to combine the best of both worlds, lever-
aging their existing knowledge of either Cocoa Touch or cocos2d to create hybrid ap-
Because Cocoa Touch and cocos2d work fundamentally in different ways and require a
different mind-set, it's usually not straightforward to create such hybrids. This chapter
will help you transition in both directions. You'll learn how to add Cocoa Touch views
and features to a cocos2d application; at the same time, you'll also learn how you can
plug in cocos2d to an existing Cocoa Touch application.
What Is Cocoa Touch?
Cocoa Touch is the name of the application programming interface (API) used to create
iOS applications. It's of course inspired by Cocoa, the API for programming Mac OS X