Cocoa and Objective-C Cookbook Move beyond basic Cocoa development using over 70 simple and effective recipes for Mac OS X development Jeff Hawkins BIRMINGHAM - MUMBAI Cocoa and Objective-C Cookbook Copyright © 2011 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: May 2011 Production Reference: 1180511 Published by Packt Publishing Ltd 32 Lincoln Road Olton Birmingham, B27 6PA, UK ISBN 978-1-849690-38-6 www.packtpub.com Cover Image by Asher Wishkerman (a.wishkerman@mpic.de) Credits Author Jeff Hawkins Reviewers Hendrik Bruinsma Project Coordinator Leena Purkait Proofreader Lesley Harrison Jofell Gallardo Piotr Isajew Mario Mosca Jorge Rodriguez Acquisition Editor Steven Wilding Development Editor Roger D’souza Technical Editor Dayan Hyames Indexer Monica Ajmera Mehta Production Coordinator Shantanu Zagade Cover Work Shantanu Zagade About the Author Jeff Hawkins has been developing software solutions and applications for 19 years He has worked for Adobe Systems supporting third party developers writing plug-ins for FrameMaker on the Macintosh, Windows, and Solaris platforms He has also worked for a startup delivering prime time television shows via satellite to television stations across the United States Jeff currently works in the Tools and Architecture group for ADP Inc designing and coding solutions for enterprise payroll systems Jeff has extensive experience working with C, C++, Objective-C, Java, and JavaScript In his spare time, Jeff enjoys working with Apple’s iOS developing mobile applications and games Jeff is also a private pilot with a seaplane rating and has built and flown his own Van’s RV-8 airplane I would like to thank my wife Sue for all the love and support while I worked on this project Her understanding and patience while I shifted priorities was truly extraordinary I would like to thank Leena Purkait, Steven Wilding, Roger D’souza, and Mary Nadar and all the others at Packt Publishing who have made this book possible About the Reviewers Hendrik Bruinsma is a Mobile Technology specialist at the Sogeti-group with a certification in Computer Sciences and Information Technology He is currently working on several mobile projects for different architectures with changing international teams With a background in embedded systems, Hendrik keeps a good eye on the limitations of mobile platforms and the requirements of his customers He has been working for Sogeti for almost five years in different roles He is a solution-minded, innovative, and creative professional, always keen to learn about and apply the latest developments in his area of expertise He is a passionate Apple fanboy Jofell Gallardo is a former developer for Insync Mac Edition (Insynchq.com) He is a technical consultant for iPad Interactive eBooks for Vibal Foundation’s Ibong Adarna, Monkey and the Turtle, and Noli Me Tangere (VibalFoundation.org) He is an iOS software engineer for CrowdSauce (CrowdSauce.com) All my hard work is for you guys, Mommy, Daddy, and my unrelenting brothers and sisters Brendan and Slade, thank you for the opportunity Sir Gus and Miss Tin for all the patience and trust Terence for the greatest break of my life Joseph Ross for the constant advice The Vibal Foundation Tech Team for all the unforgettable happy moments building apps And Leena, for finding me in this tech haystack Piotr Isajew has over 15 years of experience in software development, primarily for UNIX-like operating systems During this period, he was managing a number of development teams, while working as an IT Manager and an IT Director for media and mobile marketing companies in Poland Currently he is involved in founding a start-up mobile messaging project, and teaches Objective-C programming in a private academy in Warsaw, Poland Mario Mosca is the CEO and founder of WakeApp S.r.l , Apple development with over 10 years of experience Mario has spent a large portion of his career on developing for MacOS, but also has a extensive background in training and development for other languages WakeApp was born from the desire for innovation of two IT professionals, to create something different from the lethargy of traditional consulting Our goal is to create solutions that combine a pleasant viewing experience with an indispensable ease of use, looking for innovative ideas, presented to the public through the new digital delivery channels www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and, as a print book customer, you are entitled to a discount on the eBook copy Get in touch with us at service@ packtpub.com for more details At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library Here, you can access, read, and search across Packt's entire library of books. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books Simply use your login credentials for immediate access This book is dedicated to Sue, Katherine, and Kelly .. .Cocoa and Objective-C Cookbook Move beyond basic Cocoa development using over 70 simple and effective recipes for Mac OS X development Jeff Hawkins BIRMINGHAM - MUMBAI Cocoa and Objective-C Cookbook. .. as an IT Manager and an IT Director for media and mobile marketing companies in Poland Currently he is involved in founding a start-up mobile messaging project, and teaches Objective-C programming... read, and search across Packt's entire library of books. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible