No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permis
Trang 1ptg6843605
Trang 2Phone 7 for
Developers
Kevin Hoffman
800 East 96th Street, Indianapolis, Indiana 46240 USA
Trang 3Windows® Phone 7 for iPhone® Developers
Copyright © 2012 by Pearson Education, Inc
All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or
transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise,
without written permission from the publisher No patent liability is assumed with respect to
the use of the information contained herein Although every precaution has been taken in
the preparation of this book, the publisher and author assume no responsibility for errors or
omissions Nor is any liability assumed for damages resulting from the use of the
informa-tion contained herein
Library of Congress cataloging-in-publication data is on file
Printed in the United States of America
First Printing: August 2011
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have
been appropriately capitalized Pearson Education, Inc cannot attest to the accuracy of this
information Use of a term in this book should not be regarded as affecting the validity of
any trademark or service mark
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible,
but no warranty or fitness is implied The information provided is on an “as is” basis The
author and the publisher shall have neither liability nor responsibility to any person or entity
with respect to any loss or damages arising from the information contained in this book
Bulk Sales
Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases
or special sales For more information, please contact:
U.S Corporate and Government Sales
1-800-382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact:
International Sales
+1-317-581-3793
Greg Wiegand Executive Editor Neil Rowe Development Editor Mark Renfrow Managing Editor Kristy Hart Project Editors Jovana San Nicolas-Shirley and Elaine Wiley Copy Editor Barbara Hacha Indexer Lisa Stumpf Proofreader Seth Kerney Technical Editors Bruce Johnson Nate Dudek Publishing Coordinator Cindy Teeters Cover Designer Gary Adair Senior Compositor Gloria Schurick ISBN-13: 978-0-672-33434-4
ISBN-10: 0-672-33434-8
Trang 4❖
I want to dedicate this book to the women in my life:
Angelica, Isabella, and Jerrah.
Behind every good man is an even better woman, and
behind every good author is a woman with the patience of
a saint and a perpetually running coffeemaker.
❖
Trang 5Table of Contents
Who Are You and Why Should I Care? 1
Why Should I Read This Book? 2
The Origin of Objective-C 9
Method Calls and Message Passing 14
Reference Counting and Object
Garbage Collection 16
Cleaning Up After Yourself—
Object Finalization 18
Programming with Contracts 32
Namespaces Versus Naming Conventions 35
Extending Other People’s Classes 35
What Is Event-Driven Programming? 39
Using the Delegate Pattern in Objective-C 40
Global Events and NSNotifications 46
Trang 6Objective-C
Phrasebook
David Chisnall
ISBN-13: 978-0-321-74362-6
Programming in Objective-C, Third Edition
Stephen G Kochan
ISBN-13: 978-0-321-71139-7
Cocoa Design Patterns
Erik M Buck Donald A Yacktman
ISBN-13: 978-0-321-53502-3
Other Developer’s Library Titles
TITLE AUTHOR ISBN-13
The Object-Oriented Matt Weisfeld 978-0-672-33016-2
Thought Process
Python Essential Reference David M Beazley 978-0-672-32978-4
Cocoa Programming David Chisnall 978-0-321-63963-9
Developer’s Handbook
PHP & MySQL Web Luke Welling / Laura Thomson 978-0-672-32916-6
Development, Fourth Edition
Developer’s Library books are available at most retail and online
bookstores For more information or to order direct, visit our
online bookstore at informit.com/store
Online editions of all Developer’s Library titles are available by
subscription from Safari Books Online at safari.informit.com informit.com/devlibrary
Developer’s Library
ESSENTIAL REFERENCES FOR PROGRAMMING PROFESSIONALS
Developer’s Library
Trang 7You love our titles and you love to share them with your colleagues and friends why not earn some $$ doing it!
If you have a website, blog, or even a Facebook page, you can start earning money by putting InformIT links on your page
Whenever a visitor clicks on these links and makes
a purchase on informit.com, you earn commissions*
on all sales!
Every sale you bring to our site will earn you a commission All you have to do is post the links to the titles you want, as many as you want, and we’ll take care of the rest.
ApplY And get stArted!
It’s quick and easy to apply
To learn more go to:
http://www.informit.com/affiliates/
*Valid for all books, eBooks and video sales at www.informit.com
Join the
AffiliAte teAm!