Loading Code Samples
A comparatively recent innovation in the iOS SDK is a simplified way to open a copy of a code sample that you can play with at will without worrying about messing up the original. Figure 2-7 shows the result of clicking on a link to a code sample—called TheElements—shown at the bottom of the right pane in Figure 2-5. For sample code, the Table of Contents panel lists the files associated with the sample project. Direct your attention to the button on the righthand panel.
Figure 2-7. Landing page for the TheElements code sample
Use the following steps to load the sample into Xcode:
Click the Open Project in Xcode button.
Select the folder where the installer will create the project’s folder (i.e., a folder named TheElements will be created for you, so choose where you want that folder to go).
Click Choose.
The installer script copies all necessary files into a folder named TheElements and immediately launches the project file, named TheElements.xcodeproj. A .xcodeproj file is the master hub for everything associated with the app and is the file you open whenever you want to work on an app. Figure 2-8 shows the Xcode project window for TheElements sample project.
Figure 2-8. TheElements project window in Xcode
While the project window may look intimidating at first, you won’t ...
Get Learning the iOS 4 SDK for JavaScript Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.