learning_cocoa_with_objective-c_3rd_edition.pdf

(12290 KB) Pobierz
www.it-ebooks.info
www.it-ebooks.info
Learning Cocoa with Objective-C
Jonathon Manning and Paris Buttfield-Addison
www.it-ebooks.info
Learning Cocoa with Objective-C
by Jonathon Manning and Paris Buttfield-Addison
Copyright © 2013 Jonathon Manning, Paris Buttfield-Addison. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editors:
Brian Jepson and Rachel Roumeliotis
Production Editor:
Rachel Steely
Copyeditor:
Jasmine Kwityn
Proofreader:
Becca Freed
Indexer:
Lucie Haskins
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Robert Romano
December 2012:
Third Edition
Revision History for the Third Edition:
2012-12-06
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449318499
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Learning Cocoa with Objective-C,
the image of an Irish setter, and related trade dress are trade‐
marks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-31849-9
[LSI]
www.it-ebooks.info
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
1. Cocoa Development Tools. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
The Mac and iOS Developer Programs
Registering for a Developer Program
Downloading Xcode from Apple Developer
Getting Around in Xcode
The Xcode Interface
Developing a Simple Objective-C Application
Designing the Interface
Connecting the Code
Using the iOS Simulator
Object-Oriented Programming
Objects
Inheritance
Interfaces and Implementations
Methods
Messages
Properties
Protocols
Class Extensions
Memory Management
Reference Counting
Automatic Reference Counting
Object Graphs in Objective-C
The NSObject Life Cycle
Allocation and Initialization
Retain and Release
1
2
3
3
7
14
15
16
18
2. Object-Oriented Programming with Objective-C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
21
22
23
23
24
25
26
29
30
31
32
32
32
33
33
34
iii
www.it-ebooks.info
Zgłoś jeśli naruszono regulamin