Cocoa Touch Introductory Overview For Programmers Brought Up on C
Cocoa Touch is a framework for developing touch-screen applications: it includes User Interface elements, event dispatching, application life cycle, and so on. This also includes object wrappers around essential data types (strings, collections).
Most of the Cocoa Touch classes are designed to be called directly from your code; you can subclass these classes to add functionality, but you need to do this far less frequently in Cocoa Touch than in other languages.
The Cocoa Touch application frameworks contain most of the classes you will use to develop your first applications. The term comes from Cocoa, the object-oriented frameworks developed for Mac OS X programming (and NextStep before that), along with GUI classes uniquely designed for use on a mobile, touch-screen device (hence the “Touch”).
Cocoa Touch’s Foundation framework includes essential data classes, includes basic utilities, and establishes some core programming conventions that cannot be expressed by the Objective-C language alone, such as techniques for managing memory. Nearly all Cocoa classes inherit from a root class, NSObject defined in Foundation.
Perhaps the first and most important thing to discover in Foundation is its data management classes, which are used throughout Cocoa instead of the procedural C equivalents. For example, the traditional C suing, the null-terminated char array, is almost never used in Cocoa. Instead, you use NSString, which represents not only the character data but also its encoding: with rich support for Unicode (and the UTF- 8 and UTF- 16 encodings), the NSString makes it easy to handle text in any of the dozens of character sets on the iPhone.
Cocoa also provides a deep set of collection classes, obviating the need for most uses of C arrays (or hand-rolled collections, such as linked lists and hashtables). Three classes are used for collecting Cocoa objects: NSArray for ordered collections of objects. NSSet for unordered collections, and NSDictionary for mapping key objects to value objects. These three collections are immutable-once initialized, they can’t be changed. If you want to add, delete, or otherwise change their contents, use the mutable subclasses NSMutableArray, NSMutableSet and NSMutableDictionary.
The collections can store only NSObjects. If you have C primitives, you can pass them around Cocoa with the wrapper classes NSData and NSMutableData, which wrap a byte buffer, and NSNumber, an object container for any of C’s scalar (numeric) types, such as int, float, or bool.
Cocoa has a few more specific data classes, including NSURL for URLs (including file://-style URLs representing items on the local filesystem, though you often use NSString paths too), and timekeeping classes such as NSDate and NSTimeZone.
The “Touch” part of Cocoa Touch is largely represented by the UIKit framework, also imported by default in every iPhone application. This framework offers the drawing model, event handling, application life cycle, and other essentials for a touch-based application. You’ll largely interact with it through the various user interface component classes it provides: UIButton, UlTextView, UlTableView, and so on. Between the data types in Foundation and the UI components in UIKit, Cocoa Touch gives you a great foundation on which to start coding your application.
In summary, you should now understand that; Cocoa and Cocoa Touch are software frameworks which provide developers with the power to create intuitive applications using desktop Mac OS X and transfer them seamlessly to the iPhone OS. It is this tight integration into the Xcode development schema, (Apple call it their developer’s ecosystem) which makes app development under the big Apple’s environment such a smooth process. Additionally, Cocoa’s higher level API setup makes the tasks of adding “cool” features such as networking, animation and that certain i-Family look to your application, with relatively efficient coding, so much easier than other programming environments… once you’ve put in the time to learn its features. Like everything clever, there’s some educating to be done before you launch your career.
#Cocoa #Touch #Introductory #Overview #Programmers #Brought
Will be pleased to have you visit my pages on social networking .
Facebook page here.
Twitter account is here.0