Objective-C for Absolute Beginners (eBook)
XVII, 292 Seiten
Apress (Verlag)
978-1-4302-2833-2 (ISBN)
It seems as if everyone is writing applications for Apple's iPhone and iPad, but how do they all do it? It's best to learn Objective-C, the native language of both the iOS and Mac OS X, but where to begin? Right here, even if you've never programmed before!
Objective-C for Absolute Beginners will teach you how to write software for your Mac, iPhone, or iPad using Objective-C, an elegant and powerful language with a rich set of developer tools. Using a hands-on approach, you'll learn to think in programming terms, how to use Objective-C to build program logic, and how to write your own applications and apps.
With over 50 collective years in software development and based on an approach pioneered at Carnegie Mellon University, the authors have developed a remarkably effective approach to learning Objective-C. Since the introduction of Apple's iPhone, the authors have taught hundreds of absolute beginners how to develop Mac, iPhone,and iPad apps, including many that became popular apps in the iTunes App Store.
Gary Bennett is president of xcelMe.com. xcelMe teaches iPhone/iPad programming courses online. Gary has taught hundreds of students how to develop iPhone/iPad apps, and has several very popular apps on the iTunes App Store. Gary's students have some of the best-selling apps on the iTunes App Store. Gary also worked for 25 years in the technology and defense industries. He served 10 years in the U.S. Navy as a nuclear engineer aboard two nuclear submarines. After leaving the Navy, Gary worked for several companies as a software developer, chief information officer, and resident. As CIO, he helped take VistaCare public in 2002. Gary also co-authored iPhone Cool Projects for Apress. Gary lives in Scottsdale, Arizona with his wife, Stefanie, and their four children.
It seems as if everyone is writing applications for Apple's iPhone and iPad, but how do they all do it? It's best to learn Objective-C, the native language of both the iOS and Mac OS X, but where to begin? Right here, even if you've never programmed before! Objective-C for Absolute Beginners will teach you how to write software for your Mac, iPhone, or iPad using Objective-C, an elegant and powerful language with a rich set of developer tools. Using a hands-on approach, you ll learn to think in programming terms, how to use Objective-C to build program logic, and how to write your own applications and apps. With over 50 collective years in software development and based on an approach pioneered at Carnegie Mellon University, the authors have developed a remarkably effective approach to learning Objective-C. Since the introduction of Apple s iPhone, the authors have taught hundreds of absolute beginners how to develop Mac, iPhone,and iPad apps, including many that became popular apps in the iTunes App Store.
Gary Bennett is president of xcelMe.com. xcelMe teaches iPhone/iPad programming courses online. Gary has taught hundreds of students how to develop iPhone/iPad apps, and has several very popular apps on the iTunes App Store. Gary's students have some of the best-selling apps on the iTunes App Store. Gary also worked for 25 years in the technology and defense industries. He served 10 years in the U.S. Navy as a nuclear engineer aboard two nuclear submarines. After leaving the Navy, Gary worked for several companies as a software developer, chief information officer, and resident. As CIO, he helped take VistaCare public in 2002. Gary also co-authored iPhone Cool Projects for Apress. Gary lives in Scottsdale, Arizona with his wife, Stefanie, and their four children.
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
Erscheint lt. Verlag | 20.9.2010 |
---|---|
Zusatzinfo | XVII, 292 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Informatik ► Betriebssysteme / Server ► Macintosh / Mac OS X |
Informatik ► Programmiersprachen / -werkzeuge ► Mac / Cocoa Programmierung | |
Mathematik / Informatik ► Informatik ► Theorie / Studium | |
Schlagworte | App • Apple iOS • CoCoA • Concurrency • Debugging • Interface Builder • iPad • iPhone • Mac OS X • object • Objective-C • programming • software development • User Interfaces • Xcode |
ISBN-10 | 1-4302-2833-4 / 1430228334 |
ISBN-13 | 978-1-4302-2833-2 / 9781430228332 |
Haben Sie eine Frage zum Produkt? |
![PDF](/img/icon_pdf_big.jpg)
Größe: 19,8 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich