Objective-C for Absolute Beginners - iPhone, iPad and Mac Programming Made Easy

Objective-C for Absolute Beginners - iPhone, iPad and Mac Programming Made Easy

by: Gary Bennett, Brad Lees, Mitchell Fisher

Apress, 2010

ISBN: 9781430228332 , 292 Pages

Format: PDF, Read online

Windows PC,Mac OSX Apple iPad, Android Tablet PC's Palm OS, PocketPC 2002 und älter, PocketPC 2003 und neuer, Windows Mobile Smartphone, Handys (mit Symbian) Read Online: Windows PC,Mac OSX,Linux

Price: 29,99 EUR

More eBook Details

Objective-C for Absolute Beginners - iPhone, iPad and Mac Programming Made Easy


 

Title Page

1

Copyright Page

2

Contents at a Glance

4

Tabe of Contents

5

About the Authors

10

About the Technical Reviewer

11

Acknowledgments

12

Introduction

13

For the Newbie

13

For the More Experienced

13

Why Alice: An Innovative 3D Programming Environment

13

How This Book Is Organized

14

The Formula for Success

14

The Development Technology Stack

15

Required Software, Materials, and Equipment

15

Operating System and IDE

16

Software Development Kits

16

Dual Monitors

16

Book Forum

17

Chapter 1 Becoming a Great iPhone/iPad or Mac Programmer

18

Thinking Like a Developer

18

Completing the Development Cycle

21

Introducing Object Oriented Programming

23

Working with the Alice Interface

25

Summary

28

Exercises

28

Chapter 2 Programming Basics

29

Taking a Tour with Alice

29

Navigation Menu

30

World Window

31

Classes, Objects, and Instances in Alice

33

Object Tree

34

Editor Area

34

Details Area

35

Events Area

35

Creating an Alice App—To the Moon Alice

36

Your First Objective-C Program

42

Installing Xcode

43

Launching and Using Xcode

46

Summary

51

Exercises

52

Chapter 3 It’s All About the Data

53

Numbering Systems Used in Programming

53

Bits

53

Moore’s Law

54

Bytes

55

Hexadecimal

57

Unicode

58

Data Types

58

Using Variable and Data Types with Alice

59

Data Types and Objective-C

66

Identifying Problems

70

Summary

72

Exercises

72

Chapter 4 Making Decisions About…and Planning Program Flow

73

Boolean Logic

73

Truth Tables

75

Comparison Operators

77

Designing Apps

78

Pseudo-code

78

Design Requirements

80

Flowcharting

83

Designing and Flowcharting an Example App

84

The App’s Design

85

Using Loops to Repeat Program Statements

86

Count-Controlled Loops

86

Condition-Controlled Loops

87

Infinite Loops

87

Coding the Example App in Alice

88

Coding the Example App in Objective-C

90

Nested If Statements and Else-If Statements

93

Improving the Code Through Refactoring

93

Moving Forward Without Alice

94

Summary

95

Exercises

96

Chapter 5 Object Oriented Programming with Objective-C

97

The Object

97

What Is a Class

98

Planning Classes

99

Inheritance

109

Why Use OOP?

110

Eliminate Redundant Code

110

Ease of Debugging

111

Ease of Replacement

111

Advanced Topics

111

Interface

111

Polymorphism

111

Summary

112

Exercises

112

Chapter 6 Introducing Objective-C and Xcode

113

A Brief History of Objective-C

113

Understanding C Language Basics

114

Putting the “Objective” into Objective-C

116

Introducing Xcode

121

Starting Up Xcode

122

Creating Your First Project

123

Adding a New Class

124

Building and Running the New Program

130

Summary

131

Exercises

132

Chapter 7 Objective-C Classes, Objects, and Methods

133

Creating an Objective-C Class

133

Declaring Interfaces and Instance Variables

135

Sending Messages (Methods)

135

Using Class Methods

136

Using Instance Methods

137

Working with the Implementation File

137

Implementing Methods

139

Using Our New Class

141

Overriding Default Behavior

148

Taking Class Methods to the Next Level

149

Accessing the Xcode Documentation

149

Summary

150

Exercises

151

Chapter 8 Programming Basics in Objective-C

152

Creating a Simple Command Line Tool

153

Introducing Instance Variables

155

Accessing Instance Variables

156

Using Getter and Setter Methods

157

Introducing Properties

159

Using Properties

160

Understanding the Importance of Conventions

161

Creating the MyBookstore Program

161

Using the NSMutableDictionary Class

163

Making Our Object Do Something

164

Implementing Behavior

165

Cleaning Up Our Objects

168

Using the Bookstore and Book Objects

169

Summary

171

Exercises

171

Chapter 9 Comparing Data

172

Introducing Boolean Logic

172

Using Relational Operators

173

Comparing Numbers

173

Creating an Example Xcode App

175

Using Boolean Expressions

178

Comparing Strings

179

Comparing Dates

181

Combining Comparisons

183

Using the Switch Statement

183

Grouping Variables Together

185

NSArray

185

NSMutableArray

186

NSDictionary

187

NSMutableDictionary

187

Summary

188

Exercises

189

Chapter 10 Creating User Interfaces with Interface Builder

190

Understanding Interface Builder

191

The Model-View-Controller

192

Human Interface Guidelines (HIGs)

194

Creating an Example iPhone App with Interface Builder

195

Using Outlets

200

Implementing an Action

201

Using Interface Builder

202

Document Window

203

Library Window

204

Inspector Window

205

Creating the View

206

Connecting the Outlets and Objects

207

Connecting Actions and Objects

208

Implementation File

210

Broken Connections in Interface Builder

211

Summary

213

Exercises

213

Chapter 11Memory, Addresses, and Pointers

214

Understanding Memory

215

Bits, Bytes, and Bases

215

Converting Base-10 (Decimal) to Base-2 (Binary)

216

Using Base-16 (Hexadecimal) Numbering

217

Understanding Memory Address Basics

219

Using the Dereference Operator

222

Requesting Memory

223

Working with Automatic Variables and Pointers

223

Deallocating Memory

224

Using Special Pointers

225

Managing Memory in Objective-C

227

Using the Retain/Release Model

227

Working with Implied Retain Messages

229

Sending the dealloc Message

230

If Things Go Wrong

231

Summary

232

Exercises

233

Chapter 12 Debugging Programs with Xcode

234

Getting Started with Debugging

235

Setting Breakpoints

235

Debugging Basics

237

Working with the Debugger Controls

238

Debugging a Program

239

Using the Step Controls

240

Looking at the Thread Window and Call Stack

240

Debugging Variables

241

Deleting Multiple Breakpoints

245

Disabling Breakpoints

246

A Larger Call Stack

246

Summary

249

Exercises

250

Chapter 13 Storing Information

251

Storage Considerations

251

Preferences

251

Writing Preferences

252

Reading Preferences

253

Databases

253

Storing Information in a Database

254

Getting Started with Core Data

255

The Model

256

Managed Object Context

264

Setting Up the Interface

264

Summary

269

Exercises

269

Chapter 14 Protocols and Delegates

270

Multiple Inheritance

270

Understanding Protocols

271

Protocol Syntax

272

Understanding Delegates

272

Next Steps

273

Summary

274

Index

275