C

Crash Course in Objective-C

Objective-C is an object-oriented programming language used by Apple primarily for programming Mac OS X and iOS applications. It is an extension to the standard ANSI C language and hence it should be an easy language to pick up if you are already familiar with the C programming language. This appendix assumes that you already have some background in C programming and focuses on the object-oriented aspects of the language. If you are coming from a Java or .NET background, many of the concepts should be familiar to you; you just have to understand the syntax of Objective-C and, in particular, pay attention to the section on memory management.

Objective-C source code files are contained in two types of files:

  • .h — header files
  • .m — implementation files

For the discussions that follow, assume that you have created a Single View Application project using Xcode named LearningObjC and added an empty NSObject class named SomeClass to your project (see Figure C-1).

image

FIGURE C-1

Get Beginning iOS 5 Application Development 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.