banner

iPhone Objective-C Exercises

The only prerequisite for these exercises is an eagerness to learn. While it helps to have a background in object-oriented programming, that is not a requirement. The exercises
explain new concepts when they are needed, in a step-by-step, easy-to-understand, manner.

If you are an existing C/C++, C#, Flash, Java, PHP, Python, Ruby or similar developer, then you'll enjoy how Objective-C 2.0 handles object-oriented programming.
Objective-C was influenced by SmallTalk, one of the early object-oriented programming languages. In turn, Objective-C influenced the Java language designers, which in turn influenced
the C# language designers.

iOS uses Objective-C 2.0 as its programming language, which is a superset of the C programming language. As you work through these exercises, the Objective-C 2.0 concepts
will be covered as you come to them. It's OK if you do not have experience with Objective-C 2.0; just start Exercise 1 and work your way forward.

iOS SDK

The iPhone SDK requires an intel-based Mac. The lowest entry-level MacBook will do fine for iPhone programming. (Note that an older Mac that used the PowerPC processor will not work for the iPhone SDK; it must be an Intel-based Mac. All of the Macs over the last several years have been Intel-based, so this should not be an issue.)

  1. Join Apple Developer Connection, or ADC.
    To join, point your browser to http://developer.apple.com and register as an Apple developer.
  2. Download the iOS SDK (Software Developers Kit).
    Once you have registered on the ADC, you can download the iOS SDK. The download is quite large, so it may take some time depending on your network speed.
  3. Install the SDK.
    After you download the iOS SDK, install by clicking on the "yellow box" that says "Xcode and iPhone SDK".
  4. Startup Xcode.
    After installation, you can startup Xcode, which is the tool you will use to perform these exercises. To startup Xcode:

    1. click on Finder (the "Smiling Face" icon at the lower left of yourdesktop)
    2. select Macintosh HD near the top-left of the Finder window
    3. select the Developer folder on the right-side of the Finder window
    4. select the Applications folder
    5. double-click on Xcode.
    • Stated differently, the path to Xcode is this: /Volumes/MacintoshHD/Developer/Applications/Xcode.app.

Exercise 1: Create an iPhone Window-based App

In this exercise, you will create an iOS Window-based App named ObjCDemo. The ObjCDemo will serve as the foundation for the exercises in this book. At the end of all the exercises, you will submit the completed Obj-C Demo Project.The remaining exercises are found in the pdf document available for download at the end of this page.

  1. Start Xcode
  2. Use the Xcode main menu to select File > New Project. You will see the Xcode New Project window appear (see right ---> )
  3. On the left-side of the New Project window, under the iOS heading, make sure that Application is selected. On the right-side of the New Project window, make sure that Window-based Application is selected.
  4. Click on the Choose button.
  5. In the Save As field, enter ObjC-Demos for the project name.
  6. Click on the Save button. Xcode will display the project files for the ObjCDemos
    project (see below).

... Remaining steps are below and to the right ...

Xcode01

newProj

... Continued from above and to the left ...

  1. Near the top-middle of Xcode is a green button labeled Build and Run. Click on that button to build and run the default iPhone Window-based app. You should see the default iPhone Window-base app running in the iPhone Simulator.
  2. Press the HOME key on the iPhone Simulator to stop the default application
    from running.

... Use the link below and to the left to download the remaining assignments.

   

Click here to download a PDF document containing the remaining excercises