13.07.2015 Views

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

Beginning Objective-C pdf - EBook Free Download

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

22CHAPTER 1: Getting Started with <strong>Objective</strong>-C<strong>Objective</strong>-C Additions<strong>Objective</strong>-C adds only a few small items to the C language, and virtually all of them begin withthe @ (ampersat) symbol. <strong>Objective</strong>-C string literals (instances of the NSString class) are declaredby placing an ampersat before a regular C-string declaration: @"A string value". Similarly,NSNumber-based numbers can be created using a similar format: @42 or @812.90731 will produceNSNumber instances with the supplied integer or floating-point values.All of <strong>Objective</strong>-C’s new keywords also begin with ampersats in order to distinguish them fromregular C code, where the ampersat is not a valid character with which to begin a symbol name.Examples include @try/@catch/@finally for exception support and the @class, @interface, and@implementation keywords used to define classes. The only remaining change <strong>Objective</strong>-Cmakes to plain C is the addition of square braces around <strong>Objective</strong>-C method calls: [someObjectdoSomething]. Since no valid pure-C statement can begin with an opening square brace, thisallows the <strong>Objective</strong>-C compiler to easily compartmentalize and identify <strong>Objective</strong>-C method calls.You will see these and a whole lot more in the next chapter when you dive straight into the heartof the <strong>Objective</strong>-C language itself.SummaryIn this chapter you looked at the creation of a simple Mac application in Xcode and youwere introduced to the primary tools with which you’ll spend your time as a Mac and/or iOSdeveloper. You’ve seen how Interface Builder teams up with technologies such as bindingsto provide almost code-free creation of interactive applications and you’ve taken a tour of thefundamental building blocks of the <strong>Objective</strong>-C language itself.In the next chapter you will delve further into the world of <strong>Objective</strong>-C by learning the conceptsof object-oriented programming and how they are applied in <strong>Objective</strong>-C itself.www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!