ebook img

Objective-C For Dummies PDF

459 Pages·2009·8.631 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Objective-C For Dummies

www.free-ebooks-library.com spine=.91” Get More and Do More at Dummies.com ® Start with FREE Cheat Sheets Cheat Sheets include (cid:127) Checklists (cid:127) Charts (cid:127) Common Instructions (cid:127) And Other Good Stuff! To access the Cheat Sheet created specifically for this book, go to www.dummies.com/cheatsheet/objectivec Get Smart at Dummies.com Dummies.com makes your life easier with 1,000s of answers on everything from removing wallpaper to using the latest version of Windows. www.free-ebooks-library.com Check out our (cid:127) Videos (cid:127) Illustrated Articles (cid:127) Step-by-Step Instructions Plus, each month you can win valuable prizes by entering our Dummies.com sweepstakes. * Want a weekly dose of Dummies? Sign up for Newsletters on (cid:127) Digital Photography (cid:127) Microsoft Windows & Office (cid:127) Personal Finance & Investing (cid:127) Health & Wellness (cid:127) Computing, iPods & Cell Phones (cid:127) eBay (cid:127) Internet (cid:127) Food, Home & Garden Find out “HOW” at Dummies.com *Sweepstakes not currently available in all countries; visit Dummies.com for official rules. Objective-C® FOR DUMmIES ‰ by Neal Goldstein www.free-ebooks-library.com 0011__552222775522--ffffiirrss..iinndddd ii 88//2277//0099 99::4433::0044 PPMM Disclaimer: This eBook does not include ancillary media that was packaged with the printed version of the book. Objective-C® For Dummies® Published by Wiley Publishing, Inc. 111 River Street Hoboken, NJ 07030-5774 www.wiley.com Copyright © 2009 by Wiley Publishing, Inc., Indianapolis, Indiana Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permit- ted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Trademarks: Wiley, the Wiley Publishing logo, For Dummies, the Dummies Man logo, A Reference for the Rest of Us!, The Dummies Way, Dummies Daily, The Fun and Easy Way, Dummies.com, Making Everything Easier, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/ or its affi liates in the United States and other countries, and may not be used without written permission. Objective-C is a registered trademark of Apple, Inc.All other trademarks are the property of their respec- tive owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITH- OUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002. For technical support, please visit www.wiley.com/techsupport. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. Library of Congress Control Number: 2009935231 ISBN: 978-0-470-52275-2 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 0011__552222775522--ffffiirrss..iinndddd iiii 88//2277//0099 99::4433::0055 PPMM About the Author Neal Goldstein is a recognized leader in making state-of-the-art and cutting- edge technologies practical for commercial and enterprise development. He was one of the fi rst technologists to work with commercial developers at fi rms such as Apple Computer, Lucasfi lm, and Microsoft to develop com- mercial applications using object-based programming technologies. He was a pioneer in moving that approach into the corporate world for developers at Liberty Mutual Insurance, USWest (now Verizon), National Car Rental, EDS, and Continental Airlines, showing them how object-oriented programming could solve enterprise-wide problems. His book (with Jeff Alger) on object- oriented development, Developing Object-Oriented Software for the Macintosh (Addison Wesley, 1992), introduced the idea of scenarios and patterns to developers. He was an early advocate of the Microsoft .NET framework, and successfully introduced it into many enterprises, including Charles Schwab. He was one of the earliest developers of Service Oriented Architecture (SOA), and as Senior Vice President of Advanced Technology and the Chief Architect at Charles Schwab, he built an integrated SOA solution that spanned the enterprise, from desktop PCs to servers to complex network mainframes. (He holds three patents as a result.) As one of IBM’s largest customers, he intro- duced them to SOA at the enterprise level and encouraged them to head in that direction. He is currently leading an iPhone startup that is developing an application that will radically change how people can use iPhones to manage information. 0011__552222775522--ffffiirrss..iinndddd iiiiii 88//2277//0099 99::4433::0055 PPMM 0011__552222775522--ffffiirrss..iinndddd iivv 88//2277//0099 99::4433::0055 PPMM Dedication To my brother, Jay, who went above and beyond the call of duty to cover for me in the real world as I wandered around in Objective-C land. To my children, Sarah and Evan, who help me understand what is really important But most of all, to my wife Linda. With equanimity and grace she’s lived with me through not just one, but two books this year. If there is ever a Nobel Prize for patience, understanding, support, and friendship, she deserves the fi rst one. Author’s Acknowledgments Carole Jelen, agent extraordinaire, who does an extraordinary job of taking care of business so that I can pay attention to writing. Acquisitions Editor Kyle Looper whose understanding of programming and the issues involved in learning how to program helped make this a far better book. Project Editor Colleen Totz Diamond took over in mid stream and did an outstanding job of making this book what it is. Copy Editor Melba Hopper kept me focused on making things clear and simple. Technical reviewer Dennis Cohen added a great second pair of eyes. 0011__552222775522--ffffiirrss..iinndddd vv 88//2277//0099 99::4433::0055 PPMM Publisher’s Acknowledgments We’re proud of this book; please send us your comments at http://dummies.custhelp.com. For other comments, please contact our Customer Care Department within the U.S. at 877-762-2974, out- side the U.S. at 317-572-3993, or fax 317-572-4002. Some of the people who helped bring this book to market include the following: Acquisitions, Editorial, and Media Composition Services Development Project Coordinator: Patrick Redmond Project Editor: Colleen Totz Diamond Layout and Graphics: Samantha K. Cherolis Acquisitions Editor: Kyle Looper Proofreaders: Context Editorial Svcs, Copy Editor: Melba Hopper John Greenough Technical Editor: Dennis R. Cohen Indexer: Valerie Haynes Perry Editorial Manager: Jodi Jensen Special Help: Media Development Assistant Project David A. Diamond, Kelly Ewing Manager: Jenny Swisher Media Development Associate Producers: Josh Frank Editorial Assistant: Amanda Graham Sr. Editorial Assistant: Cherie Case Cartoons: Rich Tennant (www.the5thwave.com) Publishing and Editorial for Technology Dummies Richard Swadley, Vice President and Executive Group Publisher Andy Cummings, Vice President and Publisher Mary Bednarek, Executive Acquisitions Director Mary C. Corder, Editorial Director Publishing for Consumer Dummies Diane Graves Steele, Vice President and Publisher Composition Services Debbie Stailey, Director of Composition Services 0011__552222775522--ffffiirrss..iinndddd vvii 88//2277//0099 99::4433::0055 PPMM Contents at a Glance Introduction ................................................................ 1 Part I: Getting to the Starting Line ............................... 7 Chapter 1: Computer Programming Exposed! ................................................................9 Chapter 2: Creating Your First Program ........................................................................21 Chapter 3: The Object in Objective-C ............................................................................55 Part II: Speaking the Language of Objective-C ............. 65 Chapter 4: Language and Programming Basics ...........................................................67 Chapter 5: Functions and Data Structures ..................................................................105 Chapter 6: Adding a Little More Class to Your Program ...........................................139 Chapter 7: Objects Objects Everywhere .....................................................................167 Chapter 8: Using the Debugger ....................................................................................185 Chapter 9: Using Control Statements and Loops .......................................................201 Part III: Walking the Object-Oriented Walk .....................223 Chapter 10: Basic Inheritance ......................................................................................225 Chapter 11: Encapsulating Objects .............................................................................245 Chapter 12: The Birth of an Object .............................................................................265 Chapter 13: Getting a Handle on Memory Management ...........................................279 Part IV: Moving from Language to Application ........... 305 Chapter 14: Getting Data from Other Objects ............................................................307 Chapter 15: Show Me the Data .....................................................................................323 Chapter 16: Extending the Behavior of Objects .........................................................355 Chapter 17: Adding an iPhone User Interface ............................................................369 Chapter 18: Adding a Mac User Interface ...................................................................393 Part V: The Part of Tens ........................................... 407 Chapter 19: Ten Debugging Tips ..................................................................................409 Chapter 20: Ten Ways to Be a Happy Developer ........................................................413 Appendix: About the CD ...............................................................................................419 Index ...................................................................... 423 0022__552222775522--ffttoocc..iinndddd vviiii 88//2277//0099 99::4433::3344 PPMM 0022__552222775522--ffttoocc..iinndddd vviiiiii 88//2277//0099 99::4433::3344 PPMM

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.