Programming iOS 5 (2nd Edition).pdf

(17290 KB) Pobierz
1131692990.009.png
1131692990.010.png
SECOND EDITION
Programming iOS 5
Matt Neuburg
Beijing
Cambridge
Farnham
Köln
Sebastopol
Tokyo
1131692990.011.png 1131692990.012.png 1131692990.001.png 1131692990.002.png 1131692990.003.png 1131692990.004.png 1131692990.005.png 1131692990.006.png
Programming iOS 5, Second Edition
by Matt Neuburg
Copyright © 2012 Matt Neuburg. 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 .
Editor: Brian Jepson
Production Editor: Kristen Borg
Proofreader: O’Reilly Production Services
Indexer: Matt Neuburg
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrator: Matt Neuburg
March 2012:
Second Edition.
Revision History for the Second Edition:
2011-12-23 Early release
2012-03-12 First release
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Programming iOS 5 , the image of a kingbird, and related trade dress are trademarks
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
trademark 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 author assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.
ISBN: 978-1-449-31934-2
[M]
1331571373
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Part I.
Language
1.
Just Enough C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Compilation, Statements, and Comments
4
Variable Declaration, Initialization, and Data Types
6
Structs
8
Pointers
10
Arrays
13
Operators
14
Flow Control and Conditions
16
Functions
20
Pointer Parameters and the Address Operator
23
Files
25
The Standard Library
27
More Preprocessor Directives
28
Data Type Qualifiers
29
2.
Object-Based Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Objects
31
Messages and Methods
32
Classes and Instances
33
Class Methods
36
Instance Variables
37
The Object-Based Philosophy
38
3.
Objective-C Objects and Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
An Instance Reference Is a Pointer
43
Instance References, Initialization, and nil
44
iii
1131692990.007.png 1131692990.008.png
 
Zgłoś jeśli naruszono regulamin