Building iphone apps with html, css, and javascript: Making App Store Apps Without Objective-C or Cocoa [1 ed.] 9780596805784, 0596805780, 9781449382919, 1449382916, 9781449389000, 1449389007

What people are saying aboutBuilding iPhone Apps w/ HTML, CSS, and JavaScript "The future of mobile development is

406 127 4MB

English Pages 186 Year 2010;2011

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Building iphone apps with html, css, and javascript: Making App Store Apps Without Objective-C or Cocoa [1 ed.]
 9780596805784, 0596805780, 9781449382919, 1449382916, 9781449389000, 1449389007

Table of contents :
Table of Contents......Page 9
Preface......Page 13
Conventions Used in This Book......Page 14
Safari® Books Online......Page 15
Acknowledgments......Page 16
What Is a Native App?......Page 19
Which Approach Is Right for You?......Page 20
Intro to HTML......Page 21
Intro to CSS......Page 24
Intro to JavaScript......Page 27
Chapter 2. Basic iPhone Styling......Page 31
First Steps......Page 32
Preparing a Separate iPhone Stylesheet......Page 34
Controlling the Page Scaling......Page 35
Adding the iPhone CSS......Page 37
Adding the iPhone Look and Feel......Page 39
Adding Basic Behavior with jQuery......Page 41
What You’ve Learned......Page 46
Traffic Cop......Page 47
Simple Bells and Whistles......Page 52
Roll Your Own Back Button......Page 58
Adding an Icon to the Home Screen......Page 64
Changing the Status Bar......Page 66
Providing a Custom Startup Graphic......Page 67
What You’ve Learned......Page 68
Sliding Home......Page 69
Adding the Dates Panel......Page 73
Adding the Date Panel......Page 74
Adding the New Entry Panel......Page 76
Adding the Settings Panel......Page 78
Putting It All Together......Page 80
Customizing jQTouch......Page 82
What You’ve Learned......Page 85
localStorage and sessionStorage......Page 87
Saving User Settings to localStorage......Page 88
Saving the Selected Date to sessionStorage......Page 91
Client-Side Database......Page 92
Creating a Database......Page 93
Inserting Rows......Page 96
Error handling......Page 98
Selecting Rows and Handling Result Sets......Page 100
Deleting Rows......Page 104
What You’ve Learned......Page 107
The Basics of the Offline Application Cache......Page 109
Online Whitelist and Fallback Options......Page 112
Creating a Dynamic Manifest File......Page 116
Debugging......Page 120
The JavaScript Console......Page 121
The Application Cache Database......Page 125
What You’ve Learned......Page 131
Intro to PhoneGap......Page 133
Using the Screen’s Full Height......Page 139
Customizing the Title and Icon......Page 141
Creating a Startup Screen......Page 148
Installing Your App on the iPhone......Page 149
Beep, Vibrate, and Alert......Page 154
Geolocation......Page 158
Accelerometer......Page 164
What You’ve Learned......Page 168
Creating an iPhone Distribution Provisioning Profile......Page 169
Installing the iPhone Distribution Provisioning Profile......Page 171
Renaming the Project......Page 173
Prepare the Application Binary......Page 174
Submit Your App......Page 175
Further Reading......Page 177
Index......Page 179

Citation preview

Building iPhone Apps with HTML, CSS, and JavaScript

Building iPhone Apps with HTML, CSS, and JavaScript

-RQDWKDQ6WDUN

Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo

Building iPhone Apps with HTML, CSS, and JavaScript E\-RQDWKDQ6WDUN &RS\ULJKW‹-RQDWKDQ6WDUN$OOULJKWVUHVHUYHG 3ULQWHGLQWKH8QLWHG6WDWHVRI$PHULFD 3XEOLVKHGE\2¦5HLOO\0HGLD,QF*UDYHQVWHLQ+LJKZD\1RUWK6HEDVWRSRO&$ 2¦5HLOO\ERRNVPD\EHSXUFKDVHGIRUHGXFDWLRQDOEXVLQHVVRUVDOHVSURPRWLRQDOXVH2QOLQHHGLWLRQV DUHDOVRDYDLODEOHIRUPRVWWLWOHV KWWSP\VDIDULERRNVRQOLQHFRP )RUPRUHLQIRUPDWLRQFRQWDFWRXU FRUSRUDWHLQVWLWXWLRQDOVDOHVGHSDUWPHQW  RUFRUSRUDWH#RUHLOO\FRP

Editor: %ULDQ-HSVRQ Production Editor: 6XPLWD0XNKHUML Copyeditor: (PLO\4XLOO Proofreader: 6DGD3UHLVFK

Indexer: )UHG%URZQ Cover Designer: .DUHQ0RQWJRPHU\ Interior Designer: 'DYLG)XWDWR Illustrator: 5REHUW5RPDQR

Printing History: -DQXDU\

)LUVW(GLWLRQ

1XWVKHOO+DQGERRNWKH1XWVKHOO+DQGERRNORJRDQGWKH2¦5HLOO\ORJRDUHUHJLVWHUHGWUDGHPDUNVRI 2¦5HLOO\0HGLD,QF%XLOGLQJL3KRQH$SSVZLWK+70/&66DQG-DYD6FULSWWKHLPDJHRIDEOXHELUGDQG UHODWHGWUDGHGUHVVDUHWUDGHPDUNVRI2¦5HLOO\0HGLD,QF 0DQ\RIWKHGHVLJQDWLRQVXVHGE\PDQXIDFWXUHUVDQGVHOOHUVWRGLVWLQJXLVKWKHLUSURGXFWVDUHFODLPHGDV WUDGHPDUNV:KHUHWKRVHGHVLJQDWLRQVDSSHDULQWKLVERRNDQG2¦5HLOO\0HGLD,QFZDVDZDUHRID WUDGHPDUNFODLPWKHGHVLJQDWLRQVKDYHEHHQSULQWHGLQFDSVRULQLWLDOFDSV :KLOHHYHU\SUHFDXWLRQKDVEHHQWDNHQLQWKHSUHSDUDWLRQRIWKLVERRNWKHSXEOLVKHUDQGDXWKRUDVVXPH QRUHVSRQVLELOLW\IRUHUURUVRURPLVVLRQVRUIRUGDPDJHVUHVXOWLQJIURPWKHXVHRIWKHLQIRUPDWLRQFRQ WDLQHGKHUHLQ 7KLVZRUNLVOLFHQVHGXQGHUD&UHDWLYH&RPPRQV$WWULEXWLRQ1RQFRPPHUFLDO1R'HULYDWLYH:RUNV 8QLWHG6WDWHV/LFHQVH

TM

7KLVERRNXVHV5HS.RYHUŒDGXUDEOHDQGIOH[LEOHOD\IODWELQGLQJ ,6%1 >0@ 

7R(ULFD¢DQGWKDWOLWWOHMXPSLQJEHDQLQKHU WXPP\

Table of Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi 1. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 :HE$SSV9HUVXV1DWLYH$SSV :KDW,VD:HE$SS" :KDW,VD1DWLYH$SS" 3URVDQG&RQV :KLFK$SSURDFK,V5LJKWIRU