Professional Documents
Culture Documents
912
Application Development
g Easier!
Making Everythin
Dashcode lets you build widgets and Web apps with powerful
user interfaces for the iPhone, iPad, and the Mac OS X desktop.
If you have just a nodding acquaintance with JavaScript, this
book will have you building great Dashboard and Web
widgets in no time! Youll understand what users want and
how to put the parts together, integrate data, and add the
finishing touches.
Get acquainted with Dashcode learn to use the built-in
features, as well as the tools that help you work with them
Focus on data examine the essentials of effectively organizing
and presenting data
e
d
o
c
h
Das
Get your hands dirty work through three sample apps from
setup through working with the template and testing
Dashcode
Learn to:
Create Web apps and Dashboard widgets
for the iPhone, iPad, and Mac OS X
Go to Dummies.com
Visit the companion Web site at www.dummies.com/
go/dashcodefd to download all the code samples
used in the book.
ISBN 978-0-470-88473-7
Jesse Feiler
Feiler
Spine: .912
www.dummies.com/cheatsheet/dashcode
s
p
p
A
e
l
i
Mob
Dashcode
FOR
DUMmIES
Dashcode
FOR
DUMmIES
by Jesse Feiler
Authors Acknowledgments
Carole Jelen at Waterside Productions has, once again, provided great support and advice in the development of this book.
At Wiley, Kyle Looper, Acquisitions Editor, guided this book through the
approval process and offered very welcome input in its structuring. Kelly
Ewing patiently shepherded the manuscript through production and editing.
Publishers Acknowledgments
Were proud of this book; please send us your comments at http://dummies.custhelp.com. For
other comments, please contact our Customer Care Department within the U.S. at 877-762-2974, outside the U.S. at 317-572-3993, or fax 317-572-4002.
Some of the people who helped bring this book to market include the following:
Acquisitions, Editorial, and Media
Development
Composition Services
Contents at a Glance
Introduction ................................................................ 1
Part I: Introducing Dashcode and How You Can Use It.... 7
Chapter 1: Exploring the World of Apps and Widgets .................................................. 9
Chapter 2: Getting to Know Your Development Tools................................................ 31
Chapter 3: Creating Your First Dashcode Project ....................................................... 59
Table of Contents
Introduction ................................................................. 1
About This Book .............................................................................................. 1
Conventions Used in This Book ..................................................................... 2
What Youre Not to Read ................................................................................ 3
Foolish Assumptions ....................................................................................... 3
How this Book Is Organized ........................................................................... 4
Part I: Introducing Dashcode and How You Can Use It..................... 4
Part II: Constructing Your Projects Pieces and Parts....................... 4
Part III: Integrating Data ........................................................................ 4
Part IV: Trying Out Each Environment ................................................ 5
Part V: Refining Your Project ............................................................... 5
Part VI: The Part of Tens ....................................................................... 5
Icons Used in this Book .................................................................................. 5
Where to Go from Here ................................................................................... 6
xii
Table of Contents
Using the Metrics Inspector ....................................................................... 106
Positioning objects with document flow and absolute settings ... 106
Adjusting the autoresize settings .................................................... 107
xiii
xiv
Table of Contents
Chapter 11: Using XMLHttpRequest to Get Live Data
When You Need It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .227
Introducing XMLHttpRequest .................................................................... 228
Understanding the XMLHttpRequest Structure ...................................... 229
Partial page loads .............................................................................. 229
Asynchronous processing ................................................................ 230
Setting Up a Request ................................................................................... 231
Loading a Response .................................................................................... 233
Creating the callback routine ........................................................... 233
Checking status and data .................................................................. 235
xv
xvi
Table of Contents
Using Transformers ..................................................................................... 345
Using a simple transformer .............................................................. 345
Creating your own transformer ....................................................... 350
Using built-in transformers ............................................................... 352
Writing Your Own Handlers ....................................................................... 353
Chapter 21: Ten Simplications for Your Apps and Widgets . . . . . . .399
Use a Verb to Identify Every Interface Element You Can ....................... 399
Make Errors Impossible or Unlikely .......................................................... 401
Use Localizations and Preferences for Set-and-Forget
Customizations......................................................................................... 403
xvii
xviii
Introduction
Introduction
iPhone always means iPhone and iPod touch
iOS devices include iPhone, iPod touch, and iPad (and possibly new
devices)
The book shows you how to develop your own Dashcode projects. Several of
them are available for download at www.dummies.com/go/dashcodefd.
The full names for the projects that you build with Dashcode can be quite a
mouthful. You can build
Dashboard widgets: These widgets run in the Dashboard environment
on Mac OS X. The word widget is used in many contexts today, but in
this book, it always refers to Dashboard widgets.
Safari Web applications: In this book, you build these applications with
Dashcode. They run in Safari on Mac OS X and Windows.
Mobile Safari Web applications run in Safari on iOS devices.
You can also use other development tools than Dashcode (in particular,
Xcode) to build iOS apps, iPhone apps, and iPad apps. Those apps run
directly in the iOS operating system whereas the widgets and Safari Web
applications run in Safari. From the users point of view, these apps often
look very much the same. In fact, making your Safari Web applications and
mobile Safari Web applications look like native iOS apps is frequently an
important goal. In this book, unless otherwise noted, the word apps refers to
all three types of Dashcode projects as well as iOS apps.
Foolish Assumptions
As I wrote this book, I assumed a few things about you, the reader. I dont
assume that you have any in-depth programming experience. In fact, I wrote
this book to help novice programmers create iPhone, iPad, and Mac OS X
programs in the fastest and easiest way possible. But if youre an experienced programmer; dont worry. I tell you what you need to know to master
the syntax of Dashcode.
Introduction
This icon provides shortcuts and hints for improving your Dashcode project
as well as shortcuts to save time.
Par t I
Introducing
Dashcode and
How You Can
Use It
In this part . . .
Chapter 1
rom the very beginning, the Mac has demonstrated that it doesnt have
to hurt to use a computer. You dont have to type some obscure command; instead, you can move a mouse to click an icon. You dont have to
create a program with thousands of lines of obscure computer code in order
to generate a program. The folks at Apple have raised the bar higher and
higher so that building programs and using them is easier and easier.
And from the beginning, some people have snorted at this concept of making
computers easy to use. Talk to old-timers or read some newspaper and magazine articles from the 1980s, and youll understand how suspicious people
were of the mouse . . . not to mention all those pictures on the screen.
Apple and the Mac started to change all those viewpoints. Dashcode is just
the latest example of Apples approach to computers for the rest of us.
Dashcode makes it easy to build software thats easy to use and that does
amazing things.
This chapter shows you what you can do with Dashcode and how to do it.
10