Objective-C is a compiled language that is derived from C and is purely object-oriented. All variables are objects, and they are acted upon by sending messages to them. An object is a complex storage structure that can contain complex data and respond to a certain messages, which are determined by the object’s class type. The code syntax is very similar to C++, however sending messages to an object uses sets of brackets to delineate the target object, message, and arguments.
This is a useful language for a Scout to learn because all Apple’s mobile and desktop computers use this as their native language for programs and apps. Also, the programming environment, XCode, is free from Apple Computer. Its only limitation is that it only runs on Mac OSX computers. But if a Scout already has a Mac, it is easy to get started.
Download software: https://developer.apple.com/xcode/
Cost: Free download from Apple, Inc.
Hardware requirements: Mac
Operating systems supported: Mac OSX
Difficulty level: 5 out of 5
1. To get familiar with the XCode environment, follow along with this example. It is a simple program that sends its output to the debugging log so you can watch it run:
2. Next, follow along with this slightly more advanced tutorial that builds a simple iPhone program that includes a button press and an output label on the screen:
ABOUT THE PROGRAM — A WALK THROUGH
Programming in Objective-C involves merging several different scopes of knowledge:
- the Objective C language itself,
- the XCode programming environment, and
- the Visual Object designer for laying out where buttons and input controls appear on a form.
So as you move between these different working areas, it helps to focus on just the scope of the tool or area you are working in. There are linkages between these areas and these will become more apparent as you use it more.
1. Add another button to the iPhone form that clears the text box.
2. Add a second input control to the form to enter your name.
3. Change the “Click Me” button to copy whatever you entered into the input control into the label box.
4. Add a third button that pops up a notification window. (hint: google UIAlertView for examples)
There are tons of sample programs on the internet and how-to tutorials. Just be sure to scope your google search with the keywords for the functions in Objective-C that you are exploring.
youtube.com – LOTS of examples
google.com – Even more examples
RESOURCES, TIPS, TRICKS AND HINTS
The Apple developer site, developer.apple.com, has tons of programming guides and Q&A forums. Your local library probably will also have books on XCode, Objective-C, and iPhone programming that can fill in the blanks too. Browse the stacks at 651.8424 O, and 651.8425 I.