文档介绍:SECOND EDITION
Programming iOS 5
Matt Neuburg
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Programming iOS 5, Second Edition
by Matt Neuburg
Revision History for the :
Dec 23, 2011
See /catalog/?isbn=9781449319342 for release details.
ISBN: 978-1-449-31934-2
1326317995
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Part I. Language
1. Just Enough C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Compilation, Statements, ments 4
Variable Declaration, Initialization, and Data Types 6
Structs 8
Pointers 10
Arrays 12
Operators 13
Flow Control and Conditions 15
Functions 20
Pointer Parameters and the Address Operator 22
Files 24
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
Instance References and Assignment 47
Instance References and Memory Management 48
Messages and Methods 50
Sending a Message 50
Declaring a Method 51
Nesting Method Calls 52
No Overloading 53
Parameter Lists 54
Unrecognized Selectors 54
Typecasting and the id Type 56
Messages as Data Type 60
C Functions 61
C Struct Pointers 62
Blocks 63
4. Objective-C Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Class and Superclass 67
Interface and Imple