Learning Cocoa with Objective-C: Developing for the Mac and iOS App Stores

Learning Cocoa with Objective-C: Developing for the Mac and iOS App Stores

Paris Buttfield-Addison, Tim Nugent

Language: English

Pages: 388

ISBN: 149190139X

Format: PDF / Kindle (mobi) / ePub

Get up to speed on Cocoa and Objective-C, and start developing applications on the iOS and OS X platforms. If you don’t have experience with Apple’s developer tools, no problem! From object-oriented programming to storing app data in iCloud, the fourth edition of this book covers everything you need to build apps for the iPhone, iPad, and Mac.

You’ll learn how to work with the Xcode IDE, Objective-C’s Foundation library, and other developer tools such as Event Kit framework and Core Animation. Along the way, you’ll build example projects, including a simple Objective-C application, a custom view, a simple video player application, and an app that displays calendar events for the user.

  • Learn the application lifecycle on OS X and iOS
  • Work with the user-interface system in Cocoa and Cocoa Touch
  • Use AV Foundation to display video and audio
  • Build apps that let users create, edit, and work with documents
  • Store data locally with the file system, or on the network with iCloud
  • Display lists or collections of data with table views and collection views
  • Interact with the outside world with Core Location and Core Motion
  • Use blocks and operation queues for multiprocessing

jQuery Cookbook: Solutions & Examples for jQuery Developers

PHP for the Web: Visual QuickStart Guide (4th Edition)

Android Apps for Absolute Beginners (2nd Edition)

Design For Kids

Nuclear 2.0: Why a Green Future Needs Nuclear Power

Swift For Dummies











Add an iCloud container. Again, make the identifier the same as the Mac application. The iOS application is now ready to work with iCloud, just like the Mac app. We’ll now set up its interface, which will consist of a single text field. In order to be notified of when the user is done editing, we’ll make the view controller used in this iOS application a UITextFieldDelegate. When the user taps the Return key (which we’ll convert to a Done button), the application will store the text field’s

Xcode window Create a new project. Do this simply by clicking “Create a new Xcode project” or go to File→New→Project. You’ll be asked what kind of application to create. The template selector is divided into two areas. On the lefthand side, you’ll find a collection of categories that applications can be in. You can choose to create an iOS or Mac project template, which sets up a project directory that will get you started in the right direction. Since we’re just poking around Xcode at the

that we’ll add to the app delegate object. Create the application. Create a new Cocoa application and call it SimpleBindings. Add the property to AppDelegate. We’ll start by adding the property to the AppDelegate object. This property will simply store a number. Open AppDelegate.h and add the following property to it: property (assign) NSInteger numberValue; Once that’s added, open AppDelegate.m and synthesize it by adding the following code to AppDelegate’s @implementation: @synthesize

_created; @synthesize edited = _edited; @synthesize title = _title; Note You’ll notice that the title and text properties have nonatomic in the property descriptions. This is because we’ll be overriding the setters for these properties, and it’s helpful to let the compiler know that the setters should not be considered thread-safe, which is what nonatomic means. Update the code for Note. When the object is created, we want the created property to be set to the current date. Similarly,

contents in either an NSData or NSFileWrapper object (for flat files and file packages, respectively; if the document is a database, it saves its contents via its own mechanisms). The document controller then takes this returned object and writes it to disk. When the application is asked to open a document, the document controller determines which class is responsible for handling the document’s contents. An instance of the document class is instantiated and asked to load its data from disk;

Download sample