Atjaunināt sīkdatņu piekrišanu

Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers 2nd edition [Mīkstie vāki]

4.33/5 (14 ratings by Goodreads)
  • Formāts: Paperback / softback, 480 pages, height x width x depth: 229x180x25 mm, weight: 734 g
  • Izdošanas datums: 29-Nov-2012
  • Izdevniecība: Addison-Wesley Educational Publishers Inc
  • ISBN-10: 0321832086
  • ISBN-13: 9780321832085
  • Mīkstie vāki
  • Cena: 42,13 €*
  • * Šī grāmata vairs netiek publicēta. Jums tiks paziņota lietotas grāmatas cena
  • Šī grāmata vairs netiek publicēta. Jums tiks paziņota lietotas grāmatas cena.
  • Daudzums:
  • Ielikt grozā
  • Pievienot vēlmju sarakstam
  • Formāts: Paperback / softback, 480 pages, height x width x depth: 229x180x25 mm, weight: 734 g
  • Izdošanas datums: 29-Nov-2012
  • Izdevniecība: Addison-Wesley Educational Publishers Inc
  • ISBN-10: 0321832086
  • ISBN-13: 9780321832085
 







Get Started Fast with Objective-C 2.0 Programming for OS X Mountain Lion, iOS 5.1, and Beyond

 

Fully updated for Xcode 4.4, Learning Objective-C 2.0, Second Edition, is todays most useful beginners guide to Objective-C 2.0. One step at a time, it will help you master the newest version of Objective-C 2.0 and start writing high-quality programs for OS X 10.8 Mountain Lion, iOS 5.1, and all of Apples newest computers and devices.

 

Top OS X and iOS developer Robert Clair first reviews the essential object and C concepts that every Objective-C 2.0 developer needs to know. Next, he introduces the basics of the Objective-C 2.0 language itself, walking through code examples one line at a time and explaining whats happening behind the scenes.

 

This revised edition thoroughly introduces Apples new Automated Reference Counting (ARC), while also teaching conventional memory-management techniques that remain indispensable. Carefully building on what youve already learned, Clair progresses to increasingly sophisticated techniques in areas ranging from frameworks to security. Every topic has been carefully chosen for its value in real-world, day-to-day programming, and many topics are supported by hands-on practice exercises.

 

Coverage includes

 

·    Reviewing key C techniques and concepts, from program structure and formats to variables and scope

·    Understanding how objects and classes are applied in Objective-C 2.0

·    Writing your first Objective-C program with Xcode 4.4

·    Using messaging to efficiently perform tasks with objects

·    Getting started with Apples powerful frameworks and foundation classes

·    Using Objective-C control structures, including Fast Enumeration and exception handling

·    Adding methods to classes without subclassing

·    Using declared properties to save time and simplify your code

·    Mastering ARC and conventional memory management, and knowing when to use each

·    Using Blocks to prepare for concurrency with Apples Grand Central Dispatch

·    Leveraging Xcode 4.4 improvements to enums and @implementation

 

Recenzijas

With Learning Objective-C 2.0, Robert Clair cuts right to the chase and provides

not only comprehensive coverage of Objective-C, but also time-saving and

headache-preventing insights drawn from a depth of real-world, hands-on experience.

The combination of concise overview, examples, and specific implementation

details allows for rapid, complete, and well-rounded understanding of the language

and its core features and concepts.

 Scott D. Yelich, Mobile Application Developer













There are a number of books on Objective-C that attempt to cover the entire

gamut of object-oriented programming, the Objective-C computer language, and

application development on Apple platforms. Such a range of topics is far too ambitious

to be covered thoroughly in a single volume of finite size. Bob Clairs book is

focused on mastering the basics of Objective-C, which will allow a competent programmer

to begin writing Objective-C code.

Joseph E. Sacco, Ph.D., J.E. Sacco & Associates, Inc.

 

 

Bob Clairs Learning Objective-C 2.0 is a masterfully crafted text that provides in-depth

and interesting insight into the Objective-C language, enlightening new

programmers and seasoned pros alike. When programmers new to the language ask

about where they should start, this is the book I now refer them to.

Matt Long, Cocoa Is My Girlfriend (www.cimgf.com)

 

 

Robert Clair has taken the Objective-C language and presented it in a way that

makes it even easier to learn. Whether youre a novice or professional programmer,

you can pick up this book and begin to follow along without knowing C as

a prerequisite.

Cory Bohon, Indie Developer and Blogger for Mac|Life

 

 

I like this book because it is technical without being dry, and readable without

being fluffy.

Andy Lee, Author of AppKiDo

 

Preface xxv
Acknowledgments xxxv
About the Author xxxvii
I: Introduction to Objective-C 1(94)
1 C, the Foundation of Objective-C
3(40)
The Structure of a C Program
4(4)
main Routine
4(1)
Formatting
5(1)
Comments
5(1)
Variable and Function Names
6(1)
Naming Conventions
7(1)
Files
7(1)
Variables
8(8)
Integer Types
8(1)
Floating-Point Types
9(1)
Truth Values
9(1)
Initialization
10(1)
Pointers
10(2)
Arrays
12(1)
Multidimensional Arrays
13(1)
Strings
14(1)
Structures
14(1)
typedef
15(1)
Enumeration Constants
16(1)
Operators
16(5)
Arithmetic Operators
16(1)
Remainder Operator
17(1)
Increment and Decrement Operators
17(1)
Precedence
18(1)
Negation
18(1)
Comparisons
18(1)
Logical Operators
19(1)
Logical Negation
19(1)
Assignment Operators
19(1)
Conversion and Casting
20(1)
Other Assignment Operators
21(1)
Expressions and Statements
21(2)
Expressions
21(1)
Evaluating Expressions
22(1)
Statements
22(1)
Compound Statements
23(1)
Program Flow
23(10)
if
24(1)
Conditional Expression
25(1)
while
25(1)
do-while
26(1)
for
26(1)
break
27(1)
continue
28(1)
Comma Expression
28(1)
switch
28(1)
goto
29(1)
Functions
30(2)
Declaring Functions
32(1)
Preprocessor
33(4)
Including Files
33(1)
#define
33(1)
Conditional Compilation
34(1)
printf
35(2)
Command Line Compiling and Debugging
37(2)
Summary
39(1)
Exercises
39(4)
2 More about C Variables
43(14)
Memory Layout of a C Program
43(1)
Automatic Variables
44(2)
External Variables
46(1)
Declaration Keywords
46(4)
auto
47(1)
extern
47(1)
static
47(1)
register
48(1)
const
48(1)
volatile
49(1)
Scope
50(1)
The Scope of Automatic Variables
50(1)
Compound Statements and Scope
50(1)
The Scope of External Variables
51(1)
Dynamic Allocation
51(3)
Summary
54(1)
Exercises
55(2)
3 An introduction to Object-Oriented Programming
57(18)
Object-Oriented Programming
57(3)
Classes and Instances
58(1)
Methods
58(1)
Encapsulation
58(1)
Inheritance
59(1)
Polymorphism
60(1)
What Is the Point of an Object-Oriented Language?
60(1)
An Introduction to Objective-C
60(8)
Defining a Class
61(3)
Class Names as Types
64(1)
Messaging (Invoking a Method)
64(2)
Class Objects and Object Creation
66(1)
Memory Management
67(1)
Objective-C Additions
68(6)
Runtime
68(1)
Names
68(1)
Message Expressions
69(1)
Compiler Directives
69(1)
Literal Strings
69(1)
Objective-C Keywords
70(2)
Frameworks
72(1)
Framework Numeric Types
72(2)
Summary
74(1)
4 Your First Objective-C Program
75(20)
Building with Xcode
75(4)
Objective-C Program Structure
79(4)
Build and Run the Program
81(2)
An Object-Oriented "Hello World"
83(7)
Greeter.h
84(2)
Greeter.m
86(4)
main.m
90(2)
Build and Run the Program
91(1)
Summary
92(1)
Exercises
92(3)
II: Language Basics 95(200)
5 Messaging
97(22)
Methods
97(3)
A Simple Method
97(1)
Methods with Arguments
98(2)
Messaging
100(3)
Polymorphism
101(2)
Messaging Details
103(8)
Nesting
103(1)
Messaging nil
104(1)
Sending Messages to self
105(1)
Overriding and Messages to super
105(2)
Selectors
107(2)
Methods with the Same Name
109(1)
Dynamic and Static Typing
110(1)
Under the Hood
111(2)
Message Forwarding
113(1)
Efficiency
114(1)
Introspection and Other Runtime Fun
115(2)
Summary
117(1)
Exercises
117(2)
6 Classes and Objects
119(30)
Defining a Class
119(4)
The Interface Section
119(2)
@class Directive
121(1)
The implementation Section
122(1)
Imports
122(1)
Subclassing a Class
123(8)
Defining a Subclass
124(1)
An Example of Subclassing
124(4)
Class Hierarchies
128(1)
A Class Hierarchy Example
128(1)
Abstract Classes
129(2)
Creating Objects
131(8)
Object Allocation
131(1)
Object Initialization
132(7)
Destroying Objects
139(2)
Copying Objects
141(5)
Shallow and Deep Copies
142(1)
Mutable and Immutable Copies
142(1)
Implementing Copying in Your Own Classes
143(3)
Summary
146(1)
Exercises
146(3)
7 The Class Object
149(18)
Class Objects
149(4)
The Class Type
150(2)
Class Methods
152(1)
Other Class Methods
153(5)
Convenience Constructors
153(2)
Singletons
155(1)
Initializing Classes
156(2)
Mimicking Class Variables
158(5)
Summary
163(1)
Exercises
164(3)
8 Frameworks
167(14)
What Is a Framework?
168(1)
Using a Framework
168(1)
Cocoa and Cocoa Touch
169(1)
OS X
169(1)
iOS
170(1)
AppKit
170(1)
UlKit
171(1)
Core Foundation
172(3)
Memory Management for Core Foundation Objects
173(1)
Toll-Free Bridging
174(1)
Core Graphics
175(1)
Core Animation
176(1)
Other Apple-Supplied Frameworks
176(1)
Third-Party Frameworks
177(1)
Under the Hood
178(1)
Summary
179(2)
9 Common Foundation Classes
181(28)
Immutable and Mutable Classes
181(1)
Class Clusters
182(1)
NSString
183(5)
NSString Examples
184(2)
C String to NSString and Back
186(1)
NSMutableString
187(1)
Literal Strings
187(1)
Collection Classes
188(5)
NSArray
188(3)
NSDictionary
191(1)
NSSet
192(1)
NSNumber
193(2)
NSNull
195(1)
NSData
196(1)
Accessing NSData's Bytes
196(1)
File to NSData and Back
197(1)
NSURL
197(1)
Objective-C Literals and Object Subscripting
198(6)
NSArray Literals
198(1)
NSDictionary Literals
199(1)
NSNumber Literals
199(1)
Boxed Expressions
200(2)
Objects and Subscripting
202(1)
Adding Subscripting to Your Own Classes
203(1)
Structures
204(2)
Geometry Structures on iOS
206(1)
Summary
206(1)
Exercises
207(2)
10 Control Structures in Objective-C
209(24)
if Statements
209(4)
Testing Objects for Equality
211(2)
for Statements and Implicit Loops
213(2)
for Statements
213(1)
Implicit Loops
214(1)
Implicit Loops with Blocks
214(1)
while Statements and NSEnumerator
215(2)
Modifying a Mutable Collection While Enumerating
216(1)
Fast Enumeration
217(3)
An Example Using Fast Enumeration
220(3)
Exceptions
223(6)
Throwing Your Own Exceptions
224(1)
Multiple @catch Blocks
225(1)
Nested Exception Handling
226(1)
Using Exceptions
227(1)
Should You Use Exceptions?
228(1)
Summary
229(1)
Exercises
230(3)
11 Categories, Extensions, and Security
233(20)
Categories
233(5)
Overriding Methods with Categories
236(1)
Other Uses for Categories
237(1)
Associative References
238(2)
Extensions
240(2)
Instance Variable Scope (Access Control)
242(1)
Hiding Your Instance Variable Declarations
243(3)
Access Control for Methods
246(1)
Namespaces
246(1)
Security
246(4)
Calling C Functions from Objective-C
250(1)
Technical
250(1)
Practical
250(1)
Philosophical
250(1)
Summary
251(1)
Exercises
251(2)
12 Properties
253(26)
Accessing Instance Variables Outside of an Object (Don't Do It)
254(1)
Declaring and Implementing Accessors
255(3)
The Form of Accessors
256(2)
Accessors Using Properties
258(2)
The Instance Variable Name Can Be Different from the Property Name
259(1)
Synthesized Instance Variables
260(1)
@synthesize by Default
261(1)
Synthesis Summary
262(1)
Explicit Declaration
262(1)
Synthesize by Default
262(1)
Private Properties
263(1)
The @property Statement
263(3)
assign, retain, copy
264(1)
readwrite, readonly
264(1)
nonatomic
265(1)
setter=name, getter=name
265(1)
attributes and @dynamic
266(1)
More about @dynamic
266(1)
Properties without Instance Variables
267(1)
Properties and Memory Management
268(1)
dealloc
268(1)
A Look Ahead at Automatic Reference Counting (ARC)
269(1)
strong
269(1)
weak
269(1)
unsafe unretained
269(1)
Subclassing and Properties
270(1)
Hidden Setters for readonly Properties
271(1)
Properties as Documentation
272(1)
Dot Syntax
272(4)
Dot Syntax and Properties
274(1)
Dot Syntax and C Structures
274(2)
Summary
276(1)
Exercises
277(2)
13 Protocols
279(16)
The Rationale for Protocols
279(1)
Using Protocols
280(3)
Declaring a Protocol
280(2)
Adopting a Protocol
282(1)
Protocols as Types
282(1)
Properties and Protocols
282(1)
TablePrinter Example
283(8)
TablePrinterDataSource
284(1)
TablePrinter
285(2)
FruitBasket
287(1)
main
288(1)
A Problem
289(1)
Implement the Optional Methods
290(1)
Protocol Objects and Testing for Conformance
291(1)
Informal Protocols
291(1)
Summary
292(1)
Exercises
293(2)
III: Advanced Concepts 295(94)
14 Memory Management Overview
297(4)
The Problem
298(1)
The Solutions: Objective-C Memory Management
299(1)
Reference Counting (Manual Reference Counting)
299(1)
Automatic Reference Counting (ARC)
300(1)
Onward
300(1)
15 Reference Counting
301(24)
Reference Counting Basics
301(2)
Receiving Objects
303(2)
Ownership
305(1)
Taking Ownership by Copying
306(1)
dealloc
306(2)
Returning Objects
308(6)
Autorelease
309(1)
Autorelease Pools
309(1)
Managing Autorelease Pools
310(2)
Back to Convenience Constructors
312(1)
Autorelease and iOS
313(1)
Using Extra Autorelease Pools to Control Memory Usage
313(1)
retainCount
314(1)
Multithreading
314(2)
When Retain Counts Go Bad
316(3)
NSZombie
317(2)
Retain Cycles
319(2)
The Final Goodbye: When Programs Terminate
321(1)
Summary
322(1)
Exercises
323(2)
16 ARC
325(28)
What ARC Is and Is Not
326(1)
How ARC Works
326(2)
ARC Imposes Some Rules
328(4)
You Can't Invoke the Memory Management Methods Yourself
328(1)
ARC and dealloc
328(1)
Method Naming Conventions
329(1)
ARC Needs to See Method Declarations
330(1)
Obective-C Pointers and C Structs
331(1)
New Variable Qualifiers
332(4)
__strong
332(2)
__weak
334(1)
__autoreleasing
334(1)
__unsafe_unretained
335(1)
Properties
336(1)
Retain Cycles
337(3)
ARC and Core Foundation
340(3)
CF Objects Returned from Methods
341(1)
Toll-Free Bridging
341(2)
Casting to and from void
343(3)
ARC and Extra Autorelease Pools
346(1)
ARC and Exceptions
346(1)
Using ARC
347(2)
ARC on Mac OS X
347(1)
ARC on iOS
347(1)
Building with ARC
347(2)
ARC Uses Runtime Functions
349(1)
More Information
349(1)
Summary
350(1)
Exercises
351(2)
17 Blocks
353(28)
Function Pointers
354(5)
Calling a Function with a Function Pointer
356(1)
Using Function Pointers
356(2)
The Trouble with Function Pointers
358(1)
NSInvocation
359(3)
Blocks
362(15)
Block Pointers
362(1)
Access to Variables
363(22)
Block Variables
385
Blocks Are Stack Based
366(1)
Global Blocks
367(1)
Blocks Are Objective-C Objects
367(1)
Copying Blocks
367(1)
Memory Management for Blocks
368(1)
Capturing self
369(2)
Traps
371(2)
Blocks and ARC
373(1)
Blocks in Cocoa
374(3)
Style Issues
377(1)
Some Philosophical Reservations
377(1)
Summary
378(1)
Exercises
378(3)
18 A Few More Things
381(8)
Enums with a Fixed Underlying Type
381(3)
Setting the Underlying Type
382(1)
NS_ENUM Macro
383(1)
Type Checking Enums
383(1)
Checking switch Statements with Enum Arguments
384(1)
Forward Declarations of Methods in the @implementation Block Are No Longer Needed
384(3)
Some New Documentation
387(1)
Summary
387(1)
Exercises
387(2)
IV: Appendices 389(16)
A Reserved Words and Compiler Directives
391(2)
B Toll-Free Bridged Classes
393(2)
C 32- and 64-Bit
395(4)
Kernel and User Programs in 64-Bit
396(1)
Coding Differences for 64-Bit Programs
396(1)
Performance
396(1)
Compiling for 32-Bit and 64-Bit
397(1)
More Information
398(1)
D The Fragile Base Class Problem
399(2)
E Resources for Objective-C
401(4)
Apple Resources
401(1)
Internet Resources
402(1)
Groups
402(1)
Books
403(2)
Index 405
Robert Clair has been doing OS X development for more than ten years and iOS development since the original iOS SDK became available. He writes apps for his own company, Chromatic Bytes, LLC, and is also a leading OS X and iOS contract developer who specializes in the complete design and coding of graphics intensive programs and in repairing defective Objective-C code. He recently served as lead programmer for The Streets iPad app, and for Heritage Associates iPad auction catalog. Through Chromatic Bytes, he created the innovative iOS apps ZeusDraw Mobile and Orfeo. He holds a Ph.D. in experimental physics from the University of California, Berkeley.