100% found this document useful (1 vote)
14 views

Beginning iOS Application Development with HTML and JavaScript 1st Edition Richard Wagner download

Beginning iOS Application Development with HTML and JavaScript by Richard Wagner is a comprehensive guide for developing iOS applications using web technologies. The book covers various topics including UI design, programming interfaces, and integrating with iOS services, structured in multiple parts for ease of understanding. It is published by John Wiley & Sons and is available in various digital formats.

Uploaded by

bojarsavinqb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
14 views

Beginning iOS Application Development with HTML and JavaScript 1st Edition Richard Wagner download

Beginning iOS Application Development with HTML and JavaScript by Richard Wagner is a comprehensive guide for developing iOS applications using web technologies. The book covers various topics including UI design, programming interfaces, and integrating with iOS services, structured in multiple parts for ease of understanding. It is published by John Wiley & Sons and is available in various digital formats.

Uploaded by

bojarsavinqb
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56

Beginning iOS Application Development with HTML

and JavaScript 1st Edition Richard Wagner


download

https://ebookname.com/product/beginning-ios-application-
development-with-html-and-javascript-1st-edition-richard-wagner/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Beginning iOS Application Development with HTML and


JavaScript 1st Edition Richard Wagner

https://ebookname.com/product/beginning-ios-application-
development-with-html-and-javascript-1st-edition-richard-wagner/

Beginning Windows Store Application Development HTML


and JavaScript Edition Burns

https://ebookname.com/product/beginning-windows-store-
application-development-html-and-javascript-edition-burns/

Beginning JavaScript and CSS Development with jQuery


1st Edition York

https://ebookname.com/product/beginning-javascript-and-css-
development-with-jquery-1st-edition-york/

A Blues Bibliography 2nd Edition Robert Ford

https://ebookname.com/product/a-blues-bibliography-2nd-edition-
robert-ford/
Stem Cells and Regenerative Medicine Patents and
Clinical Trials Stem Cells Laboratory and Clinical
Research Series 1st Edition Philippe Taupin

https://ebookname.com/product/stem-cells-and-regenerative-
medicine-patents-and-clinical-trials-stem-cells-laboratory-and-
clinical-research-series-1st-edition-philippe-taupin/

No B S Time Management for Entrepreneurs 1st Edition


Dan Kennedy

https://ebookname.com/product/no-b-s-time-management-for-
entrepreneurs-1st-edition-dan-kennedy/

Habilitation Health and Agency 1st Edition Lawrence C.


Becker

https://ebookname.com/product/habilitation-health-and-agency-1st-
edition-lawrence-c-becker/

Hormones of the Limbic System 1st Edition Gerald


Litwack

https://ebookname.com/product/hormones-of-the-limbic-system-1st-
edition-gerald-litwack/

Pudd nhead Wilson Webster s German Thesaurus Edition


Mark Twain

https://ebookname.com/product/pudd-nhead-wilson-webster-s-german-
thesaurus-edition-mark-twain/
Interfaceless Conscious Design for Spatial Computing
with Generative AI 1st Edition Diana Olynick

https://ebookname.com/product/interfaceless-conscious-design-for-
spatial-computing-with-generative-ai-1st-edition-diana-olynick/
www.it-ebooks.info
www.it-ebooks.info

ffirs.indd iv 12/21/11 2:29:58 PM


BEGINNING
IOS APPLICATION DEVELOPMENT
WITH HTML AND JAVASCRIPT®

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii

 PART I GETTING STARTED


CHAPTER 1 Introducing iOS Development Using Web Technologies . . . . . . . . . . . . . 3
CHAPTER 2 Working with Core Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 3 The Document Object Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
CHAPTER 4 Writing Your First Hello World Application . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 5 Enabling and Optimizing Web Sites for the iPhone and iPad . . . . . . . . 79

 PART II APPLICATION DESIGN


CHAPTER 6 Designing the iPhone UI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
CHAPTER 7 Designing for iPad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CHAPTER 8 Styling with CSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

 PART III APPLICATION DEVELOPMENT


CHAPTER 9 Programming the Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
CHAPTER 10 Handling Touch Interactions and Events . . . . . . . . . . . . . . . . . . . . . . . . . 189
CHAPTER 11 Special Effects and Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
CHAPTER 12 Integrating with iOS Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
CHAPTER 13 Packaging Apps as Bookmarks: Bookmarklets
and Data URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

 PART IV ADVANCED PROGRAMMING TECHNIQUES


CHAPTER 14 Programming the Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
CHAPTER 15 Offline Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
CHAPTER 16 Building with Web App Frameworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
CHAPTER 17 Bandwidth and Performance Optimizations . . . . . . . . . . . . . . . . . . . . . . 303
CHAPTER 18 Debug and Deploy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

www.it-ebooks.info

ffirs.indd i 12/21/11 2:29:56 PM


 PART V NEXT STEPS: DEVELOPING NATIVE IOS APPLICATIONS
WITH HTML AND JAVASCRIPT
CHAPTER 19 Preparing for Native iOS Development . . . . . . . . . . . . . . . . . . . . . . . . . . 333
CHAPTER 20 PhoneGap: Native Apps from Your HTML, CSS,
and JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
CHAPTER 21 Submitting Your App to the App Store . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
APPENDIX Exercise Answers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375

INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381

www.it-ebooks.info

ffirs.indd ii 12/21/11 2:29:58 PM


BEGINNING

iOS Application Development


with HTML and JavaScript®

www.it-ebooks.info

ffirs.indd iii 12/21/11 2:29:58 PM


www.it-ebooks.info

ffirs.indd iv 12/21/11 2:29:58 PM


BEGINNING

iOS Application Development


with HTML and JavaScript®

Richard Wagner

John Wiley & Sons, Inc.

www.it-ebooks.info

ffirs.indd v 12/21/11 2:29:58 PM


Beginning iOS Application Development with HTML and JavaScript®
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com

Copyright © 2012 by John Wiley & Sons, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-1-118-15900-2
ISBN: 978-1-118-22607-0 (ebk)
ISBN: 978-1-118-23751-9 (ebk)
ISBN: 978-1-118-26405-8 (ebk)

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108
of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization
through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201)
748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or
promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is
sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional
services. If professional assistance is required, the services of a competent professional person should be sought. Neither
the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is
referred to in this work as a citation and/or a potential source of further information does not mean that the author or the
publisher endorses the information the organization or Web site may provide or recommendations it may make. Further,
readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this
work was written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with
standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to
media such as a CD or DVD that is not included in the version you purchased, you may download this material at
http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2011945668

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other coun-
tries, and may not be used without written permission. JavaScript is a registered trademark of Oracle America, Inc. All
other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product
or vendor mentioned in this book.

www.it-ebooks.info

ffirs.indd vi 12/21/11 2:30:03 PM


To KimmyWags and the J-Team

www.it-ebooks.info

ffirs.indd vii 12/21/11 2:30:03 PM


www.it-ebooks.info

ffirs.indd viii 12/21/11 2:30:04 PM


ABOUT THE AUTHOR

RICHARD WAGNER is Lead Product Architect of Mobile/Web at Maark, LLC. Previously, he was
the head of engineering for the Web scripting company Nombas and VP of Product Development
for NetObjects, where he was the chief architect of a CNET award-winning JavaScript tool named
NetObjects ScriptBuilder. He is an experienced web designer and developer and the author of
several Web-related books on the underlying technologies of the iOS application platform.

www.it-ebooks.info

ffirs.indd ix 12/21/11 2:30:04 PM


www.it-ebooks.info

ffirs.indd x 12/21/11 2:30:04 PM


CREDITS

EXECUTIVE EDITOR PRODUCTION MANAGER


Carol Long Tim Tate

PROJECT EDITOR VICE PRESIDENT AND EXECUTIVE GROUP


Kelly Talbot PUBLISHER
Richard Swadley
TECHNICAL EDITOR
Michael Gilbert VICE PRESIDENT AND EXECUTIVE
PUBLISHER
PRODUCTION EDITOR Neil Edde
Kathleen Wisor
ASSOCIATE PUBLISHER
COPY EDITOR Jim Minatel
Charlotte Kughen
PROJECT COORDINATOR, COVER
EDITORIAL MANAGER Katie Crocker
Mary Beth Wakefield
PROOFREADER
FREELANCER EDITORIAL MANAGER Sheilah Ledwidge, Word One
Rosemarie Graham
INDEXER
ASSOCIATE DIRECTOR OF MARKETING Robert Swanson
David Mayhew
COVER DESIGNER
MARKETING MANAGER
Ryan Sneed
Ashley Zurcher
COVER IMAGE
BUSINESS MANAGER
© Sam Burt Photography / iStockPhoto
Amy Knies

www.it-ebooks.info

ffirs.indd xi 12/21/11 2:30:04 PM


www.it-ebooks.info

ffirs.indd xii 12/21/11 2:30:05 PM


ACKNOWLEDGMENTS

THE IPHONE AND IPAD HAVE EMERGED as my favorite pieces of technology I have ever owned. As
such, the topic of iOS application development has been a joy to write about. However, the book
was also a joy because of the stellar team I had working with me on this book. First and foremost,
I’d like to thank Kelly Talbot for his masterful role as project editor. He kept the project on track
and running smoothly from start to fi nish. I’d also like to thank Michael Gilbert for his insights and
ever-watchful eye that ensured technical accuracy in this book. Further, thanks also to Charlotte
Kughen for her editing prowess.

www.it-ebooks.info

ffirs.indd xiii 12/21/11 2:30:05 PM


www.it-ebooks.info

ffirs.indd xiv 12/21/11 2:30:05 PM


CONTENTS

INTRODUCTION xxiii

PART I: GETTING STARTED

CHAPTER 1: INTRODUCING IOS DEVELOPMENT USING WEB


TECHNOLOGIES 3

Discovering the Safari on iOS Platform 3


Key Safari Features for Web Developers 6
Four Ways to Develop Web Apps for iOS 7
The Finger Is Not a Mouse 9
Limitations and Constraints 10
Setting Up Your Development Environment on a Local Network 11
CHAPTER 2: WORKING WITH CORE TECHNOLOGIES 15

Exploring HTML 5 Media Elements 15


Scripting JavaScript 18
Syntax and Basic Rules 18
Variables 20
Operators 26
Reserved Words 27
Basic Conditional Expressions 28
Loops 31
Comments 33
Functions 35
Data Types 39

CHAPTER 3: THE DOCUMENT OBJECT MODEL 47

What Is the DOM? 47


DOM as a Tree 48
Accessing the DOM from JavaScript 51
Accessing a Specific Element 51
Accessing a Set of Elements 52
Accessing Family Members 53
Retrieving Attributes 53
Manipulating the DOM 55
Creating an Element and Other Nodes 55

www.it-ebooks.info

ftoc.indd xv 12/21/11 2:35:54 PM


CONTENTS

Adding a Node to the DOM 55


Creating Other Elements 57
Setting a Value to an Attribute 59
Moving a Node 60
Cloning a Node 60
Removing a Node from the DOM 61
Removing an Attribute 62

CHAPTER 4: WRITING YOUR FIRST HELLO WORLD APPLICATION 65

Setting Up 66
Creating Your Index Page 66
Creating the Main Screen 67
Adding Detail Pages 70
CHAPTER 5: ENABLING AND OPTIMIZING WEB SITES
FOR THE IPHONE AND IPAD 79

Tier 1: iOS Compatibility 80


Tier 2: Navigation-Friendly Websites 82
Working with the Viewport 82
Turning Your Page into Blocks 85
Defining Multiple Columns (Future Use) 87
Tier 3: Custom Styling 87
Media Queries 88
Text Size Adjustment 88
Case Study: Enabling an Existing Web Site 89
Tier 4: Parallel Sites 92

PART II: APPLICATION DESIGN

CHAPTER 6: DESIGNING THE IPHONE UI 99

Evolving UI Design 99
The iPhone Viewport 100
Exploring iOS Design Patterns 102
Categorizing Apps 103
Navigation List-based UI Design 104
Application Modes 105
Exploring Screen Layout 106
Title Bar 106
Edge-to-Edge Navigation Lists 107
Rounded Rectangle Design Destination Pages 108

xvi

www.it-ebooks.info

ftoc.indd xvi 12/21/11 2:35:55 PM


CONTENTS

Designing for Touch 109


Working with Fonts 110
Best Practices in iOS UI Design 111
Adding Finishing Touches 112
CHAPTER 7: DESIGNING FOR IPAD 117

Special iPad Considerations 117


Design Essentials 118
Dealing with Scrolling 118
Split View Design Pattern 119
Designing a UI for iPad 120

CHAPTER 8: STYLING WITH CSS 135

CSS Selectors Supported in Safari 135


Text Styles 137
Controlling Text Sizing with -webkit-text-size-adjust 138
Handling Overflowed Text with text-overflow 139
Creating Subtle Shadows with text-shadow 142
Styling Block Elements 142
Image-Based Borders with -webkit-border-image 142
Rounded Corners with -webkit-border-radius 143
Gradient Push Buttons with -webkit-appearance 144
Multiple Background Images 144
Setting Transparencies 145
Creating CSS-based iOS Buttons 147
Identifying Incompatibilities 148

PART III: APPLICATION DEVELOPMENT


CHAPTER 9: PROGRAMMING THE INTERFACE 153

Top Level of Application 154


Examining Top-Level Styles 155
Adding the Top Toolbar 157
Adding a Top-Level Navigation Menu 159
Displaying a Panel with an Internal URL 160
Creating a Secondary Navigation List 162
Designing for Long Navigation Lists 163
Creating a Destination Page 164
Adding a Dialog 168

xvii

www.it-ebooks.info

ftoc.indd xvii 12/21/11 2:35:55 PM


CONTENTS

Scripting UI Behavior 178


On Document Load 179
Loading a Standard iUI Page 181
Handling Link Clicks 183
Loading a Dialog 184

CHAPTER 10: HANDLING TOUCH INTERACTIONS AND EVENTS 189

Three Types of Touch Events 189


Mouse-Emulation Events 190
Many Events Handled by Default 190
Conditional Events 190
Mouse Events: Think “Click,” Not “Move” 191
Click-Enabling Elements 192
Event Flow 192
Unsupported Events 192
Touch Events 194
Gesture Events 196
Detecting an Orientation Change 196
Changing a Style Sheet When Orientation Changes 198
Changing Element Positioning Based on Orientation Change 203
Trapping for Key Events with the On-Screen Keyboard 204
CHAPTER 11: SPECIAL EFFECTS AND ANIMATION 207

Gradients 207
Creating CSS Gradients 207
Creating Gradients with JavaScript 210
Adding Shadows 212
Adding Reflections 213
Working with Masks 215
Creating Transform Effects 217
Creating Animations 218
CHAPTER 12: INTEGRATING WITH IOS SERVICES 223

Making Phone Calls from Your App 224


Sending Emails 226
Sending SMS Messages 229
Pointing on Google Maps 230

xviii

www.it-ebooks.info

ftoc.indd xviii 12/21/11 2:35:56 PM


CONTENTS

CHAPTER 13: PACKAGING APPS AS BOOKMARKS:


BOOKMARKLETS AND DATA URLS 235

Working with Bookmarklets 236


Adding a Bookmarklet to Safari on iOS 236
Exploring How Bookmarklets Can Be Used 237
Storing an Application in a Data URL 239
Constraints and Issues with Using Data URLs 239
Developing a Data URL App 240

PART IV: ADVANCED PROGRAMMING TECHNIQUES

CHAPTER 14: PROGRAMMING THE CANVAS 251

Identifying the User Agent 251


Programming the iOS Canvas 254
Defining the Canvas Element 254
Getting a Context 254
Drawing a Simple Rectangle 256
Drawing Other Shapes 257
Drawing an Image 259
Advanced Drawing 261
Drawing with Encoded Images 262
Adding Color and Transparency 264
Creating an Image Pattern 265
CHAPTER 15: OFFLINE APPLICATIONS 269

HTML 5 Offline Application Cache 269


Create a Manifest File 270
Reference the Manifest File 271
Programmatically Control the Cache 271
Checking Connection Status 273
Using Key-Value Storage 276
Saving a Key Value 276
Loading Key-value Data 277
Deleting Key-value Data 278
Going SQL with the JavaScript Database 283
Open a Database 283
Querying a Table 283

xix

www.it-ebooks.info

ftoc.indd xix 12/21/11 2:35:56 PM


CONTENTS

CHAPTER 16: BUILDING WITH WEB APP FRAMEWORKS 287

Using jQuery Mobile 288


Using iWebKit 293
CHAPTER 17: BANDWIDTH AND PERFORMANCE
OPTIMIZATIONS 303

Optimization Strategies 303


Best Practices to Minimize Bandwidth 304
General 304
Images 305
CSS and JavaScript 305
Compressing Your Application 306
Gzip File Compression 306
JavaScript Code Compression 307
JavaScript Performance Optimizations 308
Smart DOM Access 309
Local and Global Variables 311
Dot Notation and Property Lookups 311
Avoiding Nested Properties 311
Accessing a Named Object 312
Property Lookups Inside Loops 312
String Concatenation 313
What to Do and Not to Do 314

CHAPTER 18: DEBUG AND DEPLOY 317

Simulating the iPhone or iPad on Your Development Computer 318


Xcode’s iOS Simulator 318
Using Safari on Mac or Windows 320
Working with Desktop Safari Debugging Tools 322
Working with the Develop Menu 322
Working with Safari’s Web Inspector 323
Working with the Scripts Inspector 325
Debugging on an iOS Device 326
Debug Console 326
DOM Viewer 327

xx

www.it-ebooks.info

ftoc.indd xx 12/21/11 2:35:57 PM


CONTENTS

PART V: NEXT STEPS: DEVELOPING NATIVE IOS APPLICATIONS


WITH HTML AND JAVASCRIPT

CHAPTER 19: PREPARING FOR NATIVE IOS DEVELOPMENT 333

Downloading Xcode 333


Joining the iOS Developer Program 334
Getting an iOS Developer Certificate 335
Retrieving the Developer Certificate 337
Adding a Device for Testing 337
Creating an App ID 338
Creating a Provisioning Profile 340
Installing the Development Provisioning Profile 341
CHAPTER 20: PHONEGAP: NATIVE APPS FROM
YOUR HTML, CSS, AND JAVASCRIPT 345

Installing PhoneGap 345


Creating a New PhoneGap Project in Xcode 346
Running the Base Project 348
Adding Web Files to the Xcode Project 348
Merging Your Web App Code 349
Tweaking the Xcode Project 357
Allowing External References 357
Opening External Links in Safari 358
Adding an Icon and Launch Image 359
Running the Finished App 360
CHAPTER 21: SUBMITTING YOUR APP TO THE APP STORE 363

Step 1: Getting a Distribution Certificate 364


Step 2: Creating a Distribution Provisioning Profile 365
Step 3: Building a Distribution Release of Your App 368
Step 4: Submitting Your App to the App Store 369
APPENDIX: EXERCISE ANSWERS 375

INDEX 381

xxi

www.it-ebooks.info

ftoc.indd xxi 12/21/11 2:35:57 PM


www.it-ebooks.info

flast.indd xxii 12/21/11 8:06:32 AM


INTRODUCTION

THE AMAZING SUCCESS OF THE IPHONE and iPad over the past four years has proven that
application developers are now smack deep in a brave new world of sophisticated, multifunctional
mobile applications. No longer do applications and various media need to live in separate silos.
Instead, mobile web-based applications can bring together elements of web apps, native apps,
multimedia video and audio, and the mobile device.
This book covers the various aspects of developing web-based applications for iOS. Specifically, you will
discover how to create a mobile application from the ground up, utilize existing open source frameworks
to speed up your development times, emulate the look and feel of built-in Apple applications, capture
finger touch interactions, and optimize applications for Wi-Fi and wireless networks.

WHO THIS BOOK IS FOR


This book is aimed primarily for beginning and intermediate web developers who want to build new
applications for iOS or migrate existing web apps to this platform. In general, readers will fi nd it
helpful to have a working knowledge of the following technologies:
➤ HTML/XHTML
➤ CSS
➤ JavaScript
➤ Ajax
However, if you are a less experienced working with these technologies, be sure to take advantage of
the early chapters at the start of the book.

WHAT THIS BOOK COVERS


This book introduces readers to the web application platform for iOS. It guides readers through the
process of building new applications from scratch and migrating existing web applications to this
new mobile platform. As it does so, it helps readers design a user interface that is optimized for iOS
touch-screen displays and integrate their applications with iPhone services, including Phone, Mail,
Google Maps, and GPS.

HOW THIS BOOK IS STRUCTURED


The chapter-level breakdown is as follows:
1. Introducing iOS Development Using Web Technologies. Explores the Safari development
platform and walks you through different ways you can develop apps for iOS.

www.it-ebooks.info

flast.indd xxiii 12/21/11 8:06:32 AM


Another Random Document on
Scribd Without Any Related Topics
strange that savage intellect peoples the elements with supernatural
powers; that God is everywhere, in everything; in the most trifling
accident and incident, as well as in the sun, the sea, the grove; that
when evil comes God is angry, when fortune smiles God is favorable;
and that he speaks to his wild, untutored people in signs and
dreams, in the tempest and in the sunshine. Nor does he withhold
the still, small voice, which breathes upon minds most darkened,
and into breasts the most savage, a spirit of progress, which, if a
people be left to the free fulfillment of their destiny, is sure, sooner
or later, to ripen into full development.
We will now glance at the origin of fetichism,
ORIGIN OF
FETICHISM.
which indeed may be called the origin of ideal
religion, from the other standpoint; that which
arises from the respect men feel for the memory of their departed
ancestors.
The first conception of a dualty in man's nature has been attributed
to various causes; it may be the result of a combination of causes.
There is the shadow upon the ground, separate, yet inseparable; the
reflection of the form upon the water; the echo of the voice, the
adventures of fancy portrayed by dreams. Self is divisible from and
inseparably connected with this other self. Herefrom arise
innumerable superstitions; it was portentous of misfortune for one's
clothes to be stepped on; no food must be left uneaten; nail
clippings and locks of hair must not fall into the hands of an enemy.
Catlin, in sketching his portraits, often narrowly escaped with his life,
the Indians believing that in their likenesses he carried away their
other self. And when death comes, and this other self departs,
whither has it gone? The lifeless body remains, but where is the life?
The mind cannot conceive of the total extinguishment of an entity,
and so the imagination rears a local habitation for every departed
spirit. Every phenomenon and every event is analyzed under this
hypothesis. For every event there is not only a cause, but a personal
cause, an independent agent behind every consequence. Every
animal, every fish and bird, every rock and stream and plant, the
ripening fruit, the falling rain, the uncertain wind, the sun and stars,
are all personified. There is no disease without its god or devil, no
fish entangled in the net, no beast or bird that falls before the
hunter, without its special sender.
Savages are more afraid of a dead man than a live one. They are
overwhelmed with terror at the thought of this unseen power over
them. The spirit of the departed is omnipotent and omnipresent. At
any cost or hazard it must be propitiated. So food is placed in the
grave; wives and slaves, and horses and dogs, are slain, and in spirit
sent to serve the ghost of the departed; phantom messengers are
sent to the region of shadows from time to time; the messengers
sometimes even volunteering to go. So boats and weapons and all
the property of the deceased are burned or deposited with him. In
the hand of the dead child is placed a toy; in that of the departed
warrior, the symbolic pipe of peace, which is to open a tranquil
entrance into his new abode; clothes, and ornaments, and paint, are
conveniently placed, and thus a proper personal appearance
guaranteed. Not that the things themselves are to be used, but the
souls of things. The body of the chief rots, as does the material
substance of the articles buried with it; but the soul of every article
follows the soul of its owner, to serve its own peculiar end in the
land of phantoms.
The Chinese, grown cunning with the great
THE WORSHIP OF
DEAD ANCESTORS.
antiquity of their burial customs, which require
money and food to be deposited for the benefit of
the deceased, spiritualize the money, by making an imitation coin of
pasteboard, while the food, untouched by the dead, is finally eaten
by themselves.
But whence arises the strange propensity of all primitive nations to
worship animals, and plants, and stones, things animate and
inanimate, natural and supernatural? Why is it that all nations or
tribes select from nature some object which they hold to be sacred,
and which they venerate as deity? It is the opinion of Herbert
Spencer that "the rudimentary form of all religion is the propitiation
of dead ancestors, who are supposed to be still existing, and to be
capable of working good or evil to their descendants." It is the
universal custom with savage tribes, as the character of their
members becomes developed, to drop the real name of individuals
and to fix upon them the attribute of some external object, by
whose name only they are afterwards known. Thus a swift runner is
called the 'antelope,' the slow of foot, the 'tortoise,' a merciless
warrior, the 'wolf,' a dark-eyed maid may be likened to the 'raven,' a
majestic matron to the 'cypress.' And so the rivulet, the rock, the
dawn, the sun, and even elements invisible, are seized upon as
metaphors and fastened upon individuals, according to a real or
fancied resemblance between the qualities of nature and the
character of the men. Inferiority and baseness, alike with nobleness
and wise conduct, perpetuate a name. Even in civilized societies, a
nickname often takes the place of the real name. Schoolboys are
quick to distinguish peculiarities in their fellows, and fasten upon
them significant names. A dull scholar is called 'cabbage-head,' the
girl with red ringlets, 'carrots.' In the family there is the greedy 'pig,'
the darling 'duck,' the little 'lamb.' In new countries, and abnormal
communities, where strangers from all parts are promiscuously
thrown together, not unfrequently men live on terms of intimacy for
years without ever knowing each other's real name. Among miners,
such appellations as 'Muley Bill,' 'Sandy,' 'Shorty,' 'Sassafras Jack,'
often serve all the purposes of a name. In more refined circles, there
is the hypocritical 'crocodile,' the sly 'fox,' the gruff 'bear.' We say of
the horse, 'he is as fleet as the wind,' of a rapid accountant, 'he is as
quick as lightning.' These names, which are used by us but for the
moment, or to fit occasions, are among rude nations permanent—in
many instances the only name a person ever receives.
Sometimes the nickname of the individual becomes first a family
name and then a tribal name; as when the chief, 'Coyote,' becomes
renowned, his children love to call themselves 'Coyotes.' The
chieftainship descending to the son and grandson of Coyote, the
name becomes famous, the Coyote family the dominant family of the
tribe; members of the tribe, in their intercourse with other tribes,
call themselves 'coyotes,' to distinguish themselves from other
tribes; the head, or tail, or claws, or skin, of the coyote ornaments
the dress or adorns the body; the name becomes tribal, and the
animal the symbol or totem of the tribe. After a few generations
have passed, the great chieftain, Coyote, and his immediate progeny
are forgotten; meanwhile the beast becomes a favorite with the
people; he begins to be regarded as privileged; is not hunted down
like other beasts; the virtues and exploits of the whole Coyote clan
become identified with the brute; the affections of the people are
centered in the animal, and finally, all else being lost and forgotten,
the descendants of the chieftain, Coyote, are the offspring of the
veritable beast, coyote.
Concerning image-worship and the material
ABSTRACT
CONCEPTIONS,
representation of ideal beings, Mr. Tylor believes
MONSTERS, AND that "when man has got some way in developing
METAPHORS. the religious element in him, he begins to catch at
the device of setting up a puppet, or a stone, as
the symbol and representative of the notions of a higher being which
are floating in his mind."
Primitive languages cannot express abstract qualities. For every kind
of animal or bird or plant there may be a name, but for animals,
plants, and birds in general, they have no name or conception.
Therefore, the abstract quality becomes the concrete idea of a god,
and the descendants of a man whose symbolic name was 'dog,' from
being the children of the man become the children of the dog.
Hence also arise monsters, beings compounded of beast, bird, and
fish, sphinxes, mermaids, human-headed brutes, winged animals; as
when the descendant of the 'hawk' carries off a wife from the
'salmon' tribe, a totem representing a fish with a hawk's head for a
time keeps alive the occurrence and finally becomes the deity.
Thus realities become metaphors and metaphors realities; the fact
dwindles into shadowy nothingness and the fancy springs into actual
being. The historical incident becomes first indistinct and then is
forgotten; the metaphorical name of the dead ancestor is first
respected in the animal or plant, then worshiped in the animal or
plant, and finally the nickname and the ancestor both are forgotten
and the idea becomes the entity, and the veritable object of worship.
From forgetfulness of primogenitor and metaphor, conceiving the
animal to be the very ancestor, words are put into the animal's
mouth, the sayings of the ancestor become the sayings of the brute;
hence mythological legends of talking beasts, and birds, and wise
fishes. To one animal is attributed a miraculous cure, to another,
assistance in time of trouble; one animal is a deceiver, another a
betrayer; and thus through their myths and metaphors we may look
back into the soul of savagism and into their soul of nature.
That this is the origin of some phases of fetichism there can be no
doubt; that it is the origin of all religions, or even the only method
by which animal and plant worship originates, I do not believe.
While there are undoubtedly general principles underlying all
religious conceptions, it does not necessarily follow, that in every
instance the methods of arriving at those fundamental principles
must be identical. As with us a child weeps over a dead mother's
picture, regarding it with fond devotion, so the dutiful barbarian son,
in order the better to propitiate the favor of his dead ancestor,
sometimes carves his image in wood or stone, which sentiment with
time lapses into idolatry. Any object which strikes the rude fancy as
analogous to the character of an individual may become an object of
worship.
The interpretation of myth can never be absolute and positive; yet
we may in almost every instance discover the general purport. Thus
a superior god, we may be almost sure, refers to some potent hero,
some primitive ruler, whom tradition has made superhuman in origin
and in power; demigods, subordinate or inferior beings in power,
must be regarded as legendary, referring to certain influential
persons, identified with some element or incident in which the
deified personage played a conspicuous part.
Although in mythology religion is the dominant element, yet
mythology is not wholly made up of religion, nor are all primitive
religions mythical. "There are few mistakes" says Professor Max
Müller "so widely spread and so firmly established as that which
makes us confound the religion and the mythology of the ancient
nations of the world. How mythology arises, necessarily and
naturally, I tried to explain in my former lectures, and we saw that,
as an affection or disorder of language, mythology may infect every
part of the intellectual life of man. True it is that no ideas are more
liable to mythological disease than religious ideas, because they
transcend those regions of our experience within which language
has its natural origin, and must therefore, according to their very
nature, be satisfied with metaphorical expressions. Eye hath not
seen, nor ear heard, neither hath it entered into the heart of man.
Yet even the religions of the ancient nations are by no means
inevitably and altogether mythological. On the contrary, as a
diseased frame pre-supposes a healthy frame, so a mythological
religion pre-supposes, I believe, a healthy religion."
The universal secrets of supernatural beings are
FUNDAMENTAL
IDEAS OF
wrapped up in probable or possible fable; the
RELIGION. elements of physical nature are impersonated in
allegories, and arrayed in forms perceptible to the
imagination; deities are sometimes introduced into the machinery of
the supernatural in order to gratify that love for the marvelous which
every attempt to explain the mysterious forces of nature creates in
the ignorant mind. Yet it cannot truly be said that any form of
religion, much less any religion was wholly invented. Fanatics
sometimes originate doctrines, and the Church sets forth its dogmas,
but there must be a foundation of truth or the edifice cannot stand.
Inventions there undoubtedly have been and are, but inventions,
sooner or later fall to the ground, while the essential principles
underlying religion and mythology, though momentarily overcome or
swept away, are sure to remain.
Every one of the fundamental ideas of religion is of indigenous
origin, generating spontaneously in the human heart. It is a
characteristic of mythology that the present inhabitants of the world
descended from some nobler race. From the nobler impulses of
fancy the savage derives his origin. His higher instincts teach him
that his dim distant past, and his impenetrable future, are alike of a
lighter, more ethereal nature; that his earthly nature is base, that
that which binds him to earth is the lowest, vilest part of himself.
The tendency of positive knowledge is to overthrow superstition.
Hence as science develops, many tenets of established religions,
palpably erroneous, are dropped, and the more knowledge becomes
real, the more real knowledge is denied. Superstition is not the
effect of an active imagination, but shows rather a lack of
imagination, for we see that the lower the stage of intelligence, and
the feebler the imagination, the greater the superstition. A keen,
vivid imagination, although capable of broader and more
complicated conceptions, is able to explain the cruder marvels, and
consequently to dispel the coarser phases of superstition, while the
dull intellect accepts everything which is put upon it as true.
Ultimate religious conceptions are symbolic rather than actual.
Ultimate ideas of the universe are even beyond the grasp of the
profoundest intellect. We can form but an approximate idea of the
sphere on which we live. To form conceptions of the relative and
actual distances and magnitudes of heavenly bodies, of systems of
worlds, and eternities of space, the human mind is totally
inadequate. If, therefore, the mind is unable to grasp material visible
objects, how much less are we able to measure the invisible and
eternal.
When therefore the savage attempts to solve the problem of natural
phenomena, he first reduces broad conceptions to symbolic ideas.
He moulds his deity according to the measure of his mind; and in
forming a skeleton upon which to elaborate his religious instincts,
proximate theories are accepted, and almost any explanation
appears to him plausible. The potential creations of his fancy are
brought within the compass of his comprehension; symbolic gods
are moulded from mud, or carved from wood or stone; and thus by
segregating an infinitesimal part of the vast idea of deity, the
worshiper meets the material requirements of his religious
conceptions. And although the lower forms of worship are
abandoned as the intellect unfolds, the same principle is continued.
We set up in the mind symbols of the ultimate idea which is too
great for our grasp, and imagining ourselves in possession of the
actual idea, we fall into numberless errors concerning what we
believe or think. The atheistic hypothesis of self-existence, the
pantheistic hypothesis of self-creation, and the theistic hypothesis of
creation by an external agency are equally unthinkable, and
therefore as postulates equally untenable. Yet underlying all,
however gross or superstitious the dogma, is one fundamental truth,
namely, that there is a problem to be solved, an existent mysterious
universe to be accounted for.
Deep down in every human breast is implanted a religiosity as a
fundamental attribute of man's nature; a consciousness that behind
visible appearances is an invisible power; underlying all conception is
an instinct or intuition from which there is no escape, that beyond
material actualities potential agencies are at work; and throughout
all belief, from the stupidest fetichism to the most exalted
monotheism, as part of these instinctive convictions, it is held that
the beings, or being, who rule man's destiny may be propitiated.
The first cry of nature is hushed. From time immemorial nations and
peoples have come and gone, whence and whither no one knows;
entering existence unannounced they disappear and leave no trace,
save perhaps their impress on the language or the mythology of the
world. Thus from historic fact blended with the religious sentiments
springs the Mythic Idea.

In the following chapters, I have attempted, as far as practicable, to


classify the Myths of the Pacific States under appropriate heads. In
making such a classification there is no difficulty, except where in
one myth occur two or more divisions of the
CLASSIFICATION subject, in which case it becomes necessary,
OF PACIFIC STATES' either to break the narrative, or make exceptions
MYTHS. in the general rule of classifying. I have invariably
adopted the latter alternative. The divisions which
I make of Mythology are as follows: I. Origin and End of Things; II.
Physical Myths; III. Animal Myths; IV. Gods, Supernatural Beings,
and Worship; V. The Future State.
CHAPTER II.
ORIGIN AND END OF THINGS.

Quiché Creation-Myth—Aztec Origin-Myths—The Papagos—Montezuma and the Coyote


—The Moquis—The Great Spider's Web of the Pimas—Navajo and Pueblo Creations—
Origin of Clear Lake and Lake Tahoe—Chareya of the Cahrocs—Mount Shasta, the
Wigwam of the Great Spirit—Idaho Springs and Water Falls—How Differences in
Language Occurred—Yehl, the Creator of the Thlinkeets—The Raven and the Dog.

Of all American peoples the Quichés, of


THE POPOL VUH.
Guatemala, have left us the richest mythological
legacy. Their description of the creation as given in
the Popol Vuh, which may be called the national book of the
Quichés,[II-1] is, in its rude strange eloquence and poetic originality,
one of the rarest relics of aboriginal thought. Although obliged in
reproducing it to condense somewhat, I have endeavored to give not
only the substance, but also, as far as possible, the peculiar style
and phraseology of the original. It is with this primeval picture,
whose simple silent sublimity is that of the inscrutable past, that we
begin:—
And the heaven was formed, and all the signs thereof set in their
angle and alignment, and its boundaries fixed towards the four
winds by the Creator and Former, and Mother and Father of life and
existence—he by whom all move and breathe, the Father and
Cherisher of the peace of nations and of the civilization of his people
—he whose wisdom has projected the excellence of all that is on the
earth, or in the lakes, or in the sea.
Behold the first word and the first discourse. There was as yet no
man, nor any animal, nor bird, nor fish, nor crawfish, nor any pit,
nor ravine, nor green herb, nor any tree; nothing was but the
firmament. The face of the earth had not yet appeared—only the
peaceful sea and all the space of heaven. There was nothing yet
joined together, nothing that clung to anything else; nothing that
balanced itself, that made the least rustling, that made a sound in
the heaven. There was nothing that stood up; nothing but the quiet
water, but the sea, calm and alone in its boundaries: nothing
existed; nothing but immobility and silence, in the darkness, in the
night.[II-2]
Alone also the Creator, the Former, the Dominator,
THE QUICHÉ IDEA
OF CREATION.
the Feathered Serpent—those that engender,
those that give being, they are upon the water,
like a growing light. They are enveloped in green and blue; and
therefore their name is Gucumatz.[II-3] Lo, now how the heavens
exist, how exists also the Heart of Heaven; such is the name of God;
it is thus that he is called. And they spake; they consulted together
and meditated; they mingled their words and their opinion. And the
creation was verily after this wise: Earth, they said, and on the
instant it was formed; like a cloud or a fog was its beginning. Then
the mountains rose over the water like great lobsters; in an instant
the mountains and the plains were visible, and the cypress and the
pine appeared. Then was the Gucumatz filled with joy, crying out:
Blessed be thy coming, O Heart of Heaven, Hurakan, Thunderbolt.
Our work and our labor has accomplished its end.
The earth and its vegetation having thus appeared, it was peopled
with the various forms of animal life. And the Makers said to the
animals: Speak now our name, honor us, us your mother and father;
invoke Hurakan, the Lightning-flash, the Thunderbolt that strikes,
the Heart of Heaven, the Heart of the Earth, the Creator and Former,
Him who begets, and Him who gives being—speak, call on us, salute
us! So was it said to the animals. But the animals could not answer;
they could not speak at all after the manner of men; they could only
cluck, and croak, each murmuring after his kind in a different
manner. This displeased the Creators, and they said to the animals:
Inasmuch as ye can not praise us, neither call upon our names, your
flesh shall be humiliated; it shall be broken with teeth; ye shall be
killed and eaten.
Again the gods took counsel together; they determined to make
man. So they made a man of clay; and when they had made him,
they saw that it was not good. He was without cohesion, without
consistence, motionless, strengthless, inept, watery; he could not
move his head, his face looked but one way; his sight was restricted,
he could not look behind him; he had been endowed with language,
but he had no intelligence, so he was consumed in the water.
Again is there counsel in heaven: Let us make an intelligent being
who shall adore and invoke us. It was decided that a man should be
made of wood and a woman of a kind of pith. They were made; but
the result was in no wise satisfactory. They moved about perfectly
well, it is true; they increased and multiplied; they peopled the world
with sons and daughters, little wooden mannikins like themselves;
but still the heart and the intelligence were wanting; they held no
memory of their Maker and Former; they led a useless existence,
they lived as the beasts live; they forgot the Heart of Heaven. They
were but an essay, an attempt at men; they had neither blood, nor
substance, nor moisture, nor fat; their cheeks were shrivelled, their
feet and hands dried up; their flesh languished.
Then was the Heart of Heaven wroth; and he sent
DESTRUCTION AND
RE-CREATION OF
ruin and destruction upon those ingrates; he
MAN. rained upon them night and day from heaven with
a thick resin; and the earth was darkened. And the
men went mad with terror; they tried to mount upon the roofs and
the houses fell; they tried to climb the trees and the trees shook
them far from their branches; they tried to hide in the caves and
dens of the earth, but these closed their holes against them. The
bird Xecotcovach came to tear out their eyes; and the Camalotz cut
off their head; and the Cotzbalam devoured their flesh; and the
Tecumbalam broke and bruised their bones to powder. Thus were
they all devoted to chastisement and destruction, save only a few
who were preserved as memorials of the wooden men that had
been; and these now exist in the woods as little apes.[II-4]
Once more are the gods in counsel; in the darkness, in the night of a
desolated universe do they commune together; of what shall we
make man? And the Creator and Former made four perfect men;
and wholly of yellow and white maize was their flesh composed.
These were the names of the four men that were made: the name
of the first was Balam-Quitzé; of the second, Balam-Agab; of the
third Mahucutah; and of the fourth, Iqi-Balam.[II-5] They had neither
father nor mother, neither were they made by the ordinary agents in
the work of creation; but their coming into existence was a miracle
extraordinary, wrought by the special intervention of him who is
preëminently The Creator. Verily, at last, were there found men
worthy of their origin and their destiny; verily, at last, did the gods
look on beings who could see with their eyes, and handle with their
hands, and understand with their hearts. Grand of countenance and
broad of limb the four sires of our race stood up under the white
rays of the morning star—sole light as yet of the primeval world—
stood up and looked. Their great clear eyes swept rapidly over all;
they saw the woods and the rocks, the lakes and the sea, the
mountains and the valleys, and the heavens that were above all; and
they comprehended all and admired exceedingly. Then they returned
thanks to those who had made the world and all that therein was:
We offer up our thanks, twice—yea verily, thrice! We have received
life; we speak, we walk, we taste; we hear and understand; we
know both that which is near and that which is far off; we see all
things, great and small, in all the heaven and earth. Thanks then,
Maker and Former, Father and Mother of our life! we have been
created; we are.
But the gods were not wholly pleased with this thing; Heaven they
thought had overshot its mark; these men were too perfect; knew,
understood, and saw too much. Therefore there was counsel again
in heaven: What shall we do with man now? It is not good, this that
we see; these are as gods; they would make themselves equal with
us; lo, they know all things, great and small. Let us now contract
their sight, so that they may see only a little of the surface of the
earth and be content. Thereupon the Heart of Heaven breathed a
cloud over the pupil of the eyes of men, and a veil came over it as
when one breathes on the face of a mirror; thus was the globe of
the eye darkened; neither was that which was far off clear to it any
more, but only that which was near.
Then the four men slept, and there was counsel in heaven: and four
women were made—to Balam-Quitzé was allotted Caha-Paluma to
wife; to Balam-Agab, Chomiha; to Mahucutah, Tzununiha; and to Iqi-
Balam, Cakixaha.[II-6] Now the women were exceedingly fair to look
upon; and when the men awoke, their hearts were glad because of
the women.
Next, as I interpret the narrative, there were other
THE QUICHÉS SET
OUT FOR TULAN-
men created, the ancestors of other peoples, while
ZUIVA. the first four were the fathers of all the branches
of the Quiché race. The different tribes at first,
however, lived together amicably enough, in a primitive state; and
increased and multiplied, leading happy lives under their bright and
morning star, precursor of the yet unseen sun. They had as yet no
worship save the breathing of the instinct of their soul, as yet no
altars to the gods; only—and is there not a whole idyl in the simple
words?—only they gazed up into heaven, not knowing what they
had come so far to do![II-7] They were filled with love, with
obedience, and with fear; and lifting their eyes towards heaven, they
made their requests:—
Hail! O Creator, O Former! thou that hearest and understandest us!
abandon us not, forsake us not! O God, thou that art in heaven and
on the earth, O Heart of Heaven, O Heart of Earth! give us
descendants and a posterity as long as the light endure. Give us to
walk always in an open road, in a path without snares; to lead
happy, quiet, and peaceable lives, free of all reproach. It was thus
they spake, living tranquilly, invoking the return of the light, waiting
the rising of the sun, watching the star of the morning, precursor of
the sun. But no sun came, and the four men and their descendants
grew uneasy: We have no person to watch over us, they said,
nothing to guard our symbols. So the four men and their people set
out for Tulan-Zuiva,[II-8] otherwise called the Seven-caves or Seven-
ravines, and there they received gods, each man as head of a family,
a god; though inasmuch as the fourth man, Iqi-Balam, had no
children and founded no family, his god is not usually taken into the
account. Balam-Quitzé received the god Tohil; Balam Agab received
the god Avilix; and Mahucutah received the god Hacavitz; all very
powerful gods, but Tohil seems to have been the chief, and in a
general way, god of the whole Quiché nation. Other people received
gods at the same time; and it had been for all a long march to
Tulan.
Now the Quichés had as yet no fire, and as Tulan was a much colder
climate than the happy eastern land they had left, they soon began
to feel the want of it. The god Tohil who was the creator of fire had
some in his possession; so to him, as was most natural, the Quichés
applied, and Tohil in some way supplied them with fire.
But shortly after, there fell a great rain that extinguished all the fires
of the land; and much hail also fell on the heads of the people; and
because of the rain and the hail, their fires were utterly scattered
and put out. Then Tohil created fire again by stamping with his
sandal. Several times thus fire failed them, but Tohil always renewed
it. Many other trials also they underwent in Tulan, famines and such
things, and a general dampness and cold—for the earth was moist,
there being as yet no sun.
Here also the language of all the families was confused so that no
one of the first four men could any longer understand the speech of
another. This also made them very sad. They determined to leave
Tulan; and the greater part of them, under the guardianship and
direction of Tohil, set out to see where they should take up their
abode. They continued on their way amid the most extreme
hardships for want of food; sustaining themselves at one time upon
the mere smell of their staves, and by imagining that they were
eating, when in verity and in truth, they ate nothing. Their heart,
indeed, it is again and again said, was almost broken by affliction.
Poor wanderers! they had a cruel way to go, many forests to pierce,
many stern mountains to overpass and a long passage to make
through the sea, along the shingle and pebbles and drifted sand—
the sea being, however, parted for their passage.
At last they came to a mountain that they named
QUICHÉ ORIGIN OF
THE SUN.
Hacavitz, after one of their gods, and here they
rested—for here they were by some means given
to understand that they should see the sun. Then indeed, was filled
with an exceeding joy the heart of Balam-Quitzé, of Balam-Agab, of
Mahucutah, and of Iqi-Balam. It seemed to them that even the face
of the morning star caught a new and more resplendent brightness.
They shook their incense pans and danced for very gladness: sweet
were their tears in dancing, very hot their incense—their precious
incense. At last the sun commenced to advance: the animals, small
and great, were full of delight; they raised themselves to the surface
of the water; they fluttered in the ravines; they gathered at the edge
of the mountains, turning their heads together toward that part from
which the sun came. And the lion and the tiger roared. And the first
bird that sang was that called the Queletzu. All the animals were
beside themselves at the sight; the eagle and the kite beat their
wings, and every bird, both small and great. The men prostrated
themselves on the ground, for their hearts were full to the brim.
And the sun, and the moon, and the stars were now all established.
Yet was not the sun then in the beginning the same as now; his heat
wanted force, and he was but as a reflection in a mirror; verily, say
the histories, not at all the same sun as that of to-day. Nevertheless
he dried up and warmed the surface of the earth, and answered
many good ends.
Another wonder when the sun rose! The three tribal gods, Tohil,
Avilix, and Hacavitz, were turned into stone, as were also the gods
connected with the lion, the tiger, the viper, and other fierce and
dangerous animals. Perhaps we should not be alive at this moment—
continues the chronicle—because of the voracity of these fierce
animals, of these lions, and tigers, and vipers; perhaps to-day our
glory would not be in existence, had not the sun caused this
petrification.
And the people multiplied on this Mount Hacavitz, and here they
built their city. It is here also that they began to sing that song called
Kamucu, 'we see.' They sang it, though it made their hearts ache,
for this is what they said in singing: Alas! We ruined ourselves in
Tulan, there lost we many of our kith and kin, they still remain there,
left behind! We indeed have seen the sun, but they—now that his
golden light begins to appear, where are they?
And they worshiped the gods that had become stone, Tohil, Avilix,
and Hacavitz; and they offered them the blood of beasts, and of
birds, and pierced their own ears and shoulders in honor of these
gods, and collected the blood with a sponge, and pressed it out into
a cup before them.
Toward the end of their long and eventful life Balam-Quitzé, Balam-
Agab, Mahucutah, and Iqi-Balam were impelled, apparently by a
supernatural vision, to lay before their gods a more awful offering
than the life of senseless beasts. They began to wet their altars with
the heart's blood of human victims. From their mountain hold they
watched for lonely travelers belonging to the surrounding tribes,
seized, overpowered, and slew them for a sacrifice. Man after man
was missing in the neighboring villages; and the people said: Lo! the
tigers have carried them away—for wherever the blood was of a
man slain, were always found the tracks of many tigers. Now this
was the craft of the priests, and at last the tribes began to suspect
the thing and to follow the tracks of the tigers. But the trails had
been made purposely intricate, by steps returning on themselves
and by the obliteration of steps; and the mountain region where the
altars were was already covered with a thick fog and a small rain,
and its paths flowed with mud.
The hearts of the villagers were thus fatigued within them, pursuing
unknown enemies. At last, however, it became plain that the gods
Tohil, Avilix and Hacavitz, and their worship, were in some way or
other the cause of this bereavement: so the people of the villages
conspired against them. Many attacks, both openly and by ruses, did
they make on the gods, and on the four men, and on the children
and people connected with them; but not once did they succeed, so
great was the wisdom, and power, and courage of the four men and
of their deities. And these three gods petrified, as we have told,
could nevertheless resume a movable shape when they pleased;
which indeed they often did, as will be seen hereafter.
At last the war was finished. By the miraculous aid of a horde of
wasps and hornets, the Quichés utterly defeated and put to the rout
in a general battle all their enemies. And the tribes humiliated
themselves before the face of Balam-Quitzé, of Balam-Agab, and of
Mahucutah: Unfortunates that we are, they said, spare to us at least
our lives. Let it be so, it was answered, although you be worthy of
death; you shall, however, be our tributaries and serve us, as long as
the sun endure, as long as the light shall follow his course. This was
the reply of our fathers and mothers, upon Mount Hacavitz; and
thereafter they lived in great honor and peace, and their souls had
rest, and all the tribes served them there.
Now it came to pass that the time of the death of
THE END OF THE
QUICHÉ CREATION.
Balam-Quitzé, Balam-Agab, Mahucutah, and Iqi-
Balam drew near. No bodily sickness nor suffering
came upon them; but they were forewarned that their death and
their end was at hand. Then they called their sons and their
descendants round them to receive their last counsels.
And the heart of the old men was rent within them. In the anguish
of their heart they sang the Kamucu, the old sad song that they had
sung when the sun first rose, when the sun rose and they thought of
the friends they had left in Tulan, whose face they should see no
more forever. Then they took leave of their wives, one by one; and
of their sons, one by one; of each in particular they took leave; and
they said: We return to our people; already the King of the Stags is
ready, he stretches himself through the heaven. Lo, we are about to
return; our work is done; the days of our life are complete.
Remember us well; let us never pass from your memory. You will see
still our houses and our mountains; multiply in them, and then go on
upon your way and see again the places whence we are come.
So the old men took leave of their sons and of their wives; and
Balam-Quitzé spake again: Behold! he said, I leave you what shall
keep me in remembrance. I have taken leave of you—and am filled
with sadness, he added. Then instantly the four old men were not;
but in their place was a great bundle; and it was never unfolded,
neither could any man find seam therein on rolling it over and over.
So it was called the Majesty Enveloped; and it became a memorial of
these fathers, and was held very dear and precious in the sight of
the Quichés; and they burned incense before it.[II-9]
Thus died and disappeared on Mount Hacavitz Balam-Quitzé, Balam-
Agab, Mahucutah, and Iqi-Balam, these first men who came from
the east, from the other side of the sea. Long time had they been
here when they died; and they were very old, and surnamed the
Venerated and the Sacrificers.

Such is the Quiché account of the creation of the earth and its
inhabitants and of the first years of the existence of mankind.
Although we find here described in the plainest and least equivocal
terms a supreme, all-powerful Creator of all things, there are joined
with him in a somewhat perplexing manner a number of auxiliary
deities and makers. It may be that those whose faith the Popol Vuh
represents, conceiving and speaking of their supreme god under
many aspects and as fulfilling many functions, came at times, either
unconsciously or for dramatic effect, to bring this one great Being
upon their mythic stage, sustaining at once many of his different
parts and characters. Or perhaps, like the Hebrews, they believed
that the Creator had made out of nothing or out of his own essence,
in some mysterious way, angels and other beings to obey and to
assist him in his sovereign designs, and that these 'were called
gods.' That these Quiché notions seem foolishness to us, is no
argument as to their adaptation to the life and thoughts of those
who believed them; for, in the words of Professor Max Müller, "the
thoughts of primitive humanity were not only different from our
thoughts, but different also from what we think their thoughts ought
to have been."[II-10]
Yet whatever be the inconsistencies that obscure
MEXICAN
COSMOGONY.
the Popol Vuh, we find them multiplied in the
Mexican cosmogony, a tangled string of meagre
and apparently fragmentary traditions. There appear to have been
two principal schools of opinion in Anáhuac, differing as to who was
the Creator of the world, as well as on other points—two veins of
tradition, perhaps of common origin, which often seem to run into
one, and are oftener still considered as one by historians to whom
these heathen vanities were matters of little importance. The more
advanced school, ascribing its inspiration to Toltec sources, seems to
have flourished notably in Tezcuco, especially while the famous
Nezahualcoyotl reigned there, and to have had very definite
monotheistic ideas. It taught, as is asserted in unmistakable terms,
that all things had been made by one God, omnipotent and invisible;
and to this school were probably owing the many gentle and
beautiful ideas and rites, mingled with the hard, coarse, and prosaic
cult of the mass of the people.[II-11]
The other school may be considered as more distinctively national,
and as representing more particularly the ordinary Mexican mind. To
it is to be ascribed by far the larger part of all we know about the
Mexican religion.[II-12] According to the version of this school,
Tezcatlipoca, a god whose birth and adventures are set forth
hereafter, was the creator of the material heaven and earth, though
not of mankind; and sometimes even the honor of this partial
creation is disputed by others of the gods.
One Mexican nation, again, according to an ancient writer of their
own blood, affirmed that the earth had been created by chance; and
as for the heavens, they had always existed.[II-13]
From the fragments of the Chimalpopoca
CHIMALPOPOCA
MANUSCRIPT.
manuscript given by the Abbé Brasseur de
Bourbourg we learn that the Creator—whoever he
may have been—produced his work in successive epochs. In the sign
Tochtli, the earth was created; in the sign Acatl was made the
firmament, and in the sign Tecpatl the animals. Man it is added, was
made and animated out of ashes or dust by God on the seventh day,
Ehecatl, but finished and perfected by that mysterious personage
Quetzalcoatl. However this account may be reconciled with itself or
with others, it further appears that man was four times made and
four times destroyed.[II-14]
This may perhaps be looked upon as proceeding from what I have
called for convenience the Toltecan school, though this particular
fragment shows traces of Christian influence. What follows seems
however to belong to a distinctively Mexican and ruder vein of
thought. It is gathered from Mendieta, who was indebted again to
Fray Andres de Olmos, one of the earliest missionaries among the
Mexicans of whom he treats; and it is decidedly one of the most
authentic accounts of such matters extant.
The Mexicans in most of the provinces were
AZTEC CREATION-
MYTHS.
agreed that there was a god in heaven called
Citlalatonac, and a goddess called Citlalicue;[II-15] and that this
goddess had given birth to a flint knife, Tecpatl. Now she had many
sons living with her in heaven, who seeing this extraordinary thing
were alarmed, and flung the flint down to the earth. It fell in a place
called Chicomoztoc, that is to say the Seven Caves, and there
immediately sprang up from it one thousand six hundred gods.
These gods being alone on the earth—though as will hereafter
appear, there had been men in the world at a former period—sent
up their messenger Tlotli, the Hawk, to pray their mother to
empower them to create men, so that they might have servants as
became their lineage. Citlalicue seemed to be a little ashamed of
these sons of hers, born in so strange a manner, and she twitted
them cruelly enough on what they could hardly help: Had you been
what you ought to have been, she exclaimed, you would still be in
my company. Nevertheless she told them what to do in the matter of
obtaining their desire: Go beg of Mictlanteuctli, Lord of Hades, that
he may give you a bone or some ashes of the dead that are with
him; which having received you shall sacrifice over it, sprinkling
blood from your own bodies. And the fallen gods having consulted
together, sent one of their number, called Xolotl,[II-16] down to
hades as their mother had advised. He succeeded in getting a bone
of six feet long from Mictlanteuctli; and then, wary of his grisly host,
he took an abrupt departure, running at the top of his speed. Wroth
at this, the infernal chief gave chase; not causing to Xolotl, however,
any more serious inconvenience than a hasty fall in which the bone
was broken in pieces. The messenger gathered up what he could in
all haste, and despite his stumble made his escape. Reaching the
earth, he put the fragments of bone into a basin, and all the gods
drew blood from their bodies and sprinkled it into the vessel. On the
fourth day there was a movement among the wetted bones and a
boy lay there before all; and in four days more, the blood-letting and
sprinkling being still kept up, a girl was lifted from the ghastly dish.
The children were given to Xolotl to bring up; and he fed them on
the juice of the maguey.[II-17] Increasing in stature, they became
man and woman; and from them are the people of the present day
descended, who, even as the primordial bone was broken into
unequal pieces, vary in size and shape. The name of this first man
was Iztacmixcuatl, and the name of his wife Ilancueitl,[II-18] and
they had six sons born to them, whose descendants, with their god-
masters, in process of time moved eastward from their original
home, almost universally described as having been towards Jalisco.
Now there had been no sun in existence for many years; so the gods
being assembled in a place called Teotihuacan, six leagues from
Mexico, and gathered at the time round a great fire, told their
devotees that he of them who should first cast himself into that fire,
should have the honor of being transformed into a sun. So one of
them called Nanahuatzin—either as most say, out of pure bravery, or
as Sahagun relates, because his life had become a burden to him
through a syphilitic disease—flung himself into the fire. Then the
gods began to peer through the gloom in all directions for the
expected light and to make bets as to what part of heaven he should
first appear in. And some said Here, and some said There; but when
the sun rose they were all proved wrong, for not one of them had
fixed upon the east.[II-19] And in that same hour, though they knew
it not, the decree went forth that they should all die by sacrifice.
The sun had risen indeed, and with a glory of the
HOW THE SUN WAS
PLACED IN THE
cruel fire about him that not even the eyes of the
HEAVENS. gods could endure; but he moved not. There he
lay on the horizon; and when the deities sent Tlotli
their messenger to him, with orders that he should go on upon his
way, his ominous answer was, that he would never leave that place
till he had destroyed and put an end to them all. Then a great fear
fell upon some, while others were moved only to anger; and among
the latter was one Citli, who immediately strung his bow and
advanced against the glittering enemy. By quickly lowering his head
the Sun avoided the first arrow shot at him; but the second and third
had attained his body in quick succession, when, filled with fury, he
seized the last and launched it back upon his assailant. And the
brave Citli laid shaft to string nevermore, for the arrow of the sun
pierced his forehead.
Then all was dismay in the assembly of the gods, and despair filled
their heart, for they saw that they could not prevail against the
shining one; and they agreed to die, and to cut themselves open
through the breast. Xolotl was appointed minister, and he killed his
companions one by one, and last of all he slew himself also.[II-20] So
they died like gods; and each left to the sad and wondering men
who were his servants, his garments for a memorial. And these
servants made up, each party, a bundle of the raiment that had been
left to them, binding it about a stick into which they had bedded a
small green stone to serve as a heart. These bundles were called
tlaquimilloli, and each bore the name of that god whose memorial it
was; and these things were more reverenced than the ordinary gods
of stone and wood of the country. Fray Andres de Olmos found one
of these relics in Tlalmanalco, wrapped up in many cloths, and half
rotten with being kept hid so long.[II-21]
Immediately on the death of the gods the sun began his motion in
the heavens; and a man called Tecuzistecatl, or Tezcociztecatl, who,
when Nanahuatzin leaped into the fire, had retired into a cave, now
emerged from his concealment as the moon. Others say that instead
of going into a cave, this Tecuzistecatl, had leaped into the fire after
Nanahuatzin, but that, the heat of the fire being somewhat abated,
he had come out less brilliant than the sun. Still another variation is,
that the sun and moon came out equally bright, but this not seeming
good to the gods, one of them took a rabbit by the heels and slung
it into the face of the moon, dimming its lustre with a blotch whose
mark may be seen to this day.
After the gods had died in the way herein related, leaving their
garments behind as relics, those servants went about everywhere,
bearing these relics like bundles upon their shoulders, very sad and
pensive and wondering if ever again they would see their departed
gods. Now the name of one of these deceased deities was
Tezcatlipoca, and his servant having arrived at the sea coast, was
favored with an apparition of his master in three different shapes.
And Tezcatlipoca spake to his servant saying: Come hither, thou that
lovest me so well, that I may tell thee what thou hast to do. Go now
to the House of the Sun and fetch thence singers and instruments so
that thou mayest make me a festival; but first call upon the whale,
and upon the siren, and upon the tortoise, and they shall make thee
a bridge to the sun.
Then was all this done; and the messenger went across the sea
upon his living bridge, towards the House of the Sun, singing what
he had to say. And the Sun heard the song, and he straitly charged
his people and servants, saying: See now that ye make no response
to this chant, for whoever replies to it must be taken away by the
singer. But the song was so exceeding sweet that some of them
could not but answer, and they were lured away, bearing with them
the drum, teponaztli, and the kettle-drum, vevetl. Such was the
origin of the festivals and the dances to the gods; and the songs
sung during these dances they held as prayers, singing them always
with great accuracy of intonation and time.
In their oral traditions, the Tezcucans agreed with
THE TEZCUCAN
ACCOUNT OF THE
the usual Mexican account of creation—the falling
CREATION. of the flint from heaven to earth, and so on—but
what they afterward showed in a picture, and
explained to Fray Andres de Olmos as the manner of the creation of
mankind, was this: The event took place in the land of Aculma, on
the Tezcucan boundary at a distance of two leagues from Tezcuco
and of five from Mexico. It is said that the sun, being at the hour of
nine, cast a dart into the earth at the place we have mentioned and
made a hole; from this hole a man came out, the first man and
somewhat imperfect withal, as there was no more of him than from
the arm-pits up, much like the conventional European cherub, only
without wings. After that the woman came up out of the hole. The
rest of the story was not considered proper for printing by Mendieta;
but at any rate from these two are mankind descended. The name
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like