When to Use Subclassing in iPhone and iPad Game Development

By Neal Goldstein, Jon Manning, Paris Buttfield-Addison

Part of iPhone and iPad Game Development For Dummies Cheat Sheet

Subclassing is one of the mechanisms you use to customize behaviors while you develop your iPhone or iPad game. Subclassing involves the following two stages:

  • Creating a new class, dubbed a subclass, that inherits properties from another (super) class

  • Adding properties as needed for your iPhone application

In general, you want to subclass

  • UIView: To create your (more complex) content views, which you may fill with controls, graphics, and the like

  • UIViewController: To manage the content views and connect it to the model

  • NSObject: To create Model views and delegates