04.07.2013 Views

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

Building iPhone Apps with HTML, CSS, and ... - Cdn.oreilly.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

What You’ve Learned 50<br />

4. Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51<br />

With a Little Help from Our Friend 51<br />

Sliding Home 51<br />

Adding the Dates Panel 55<br />

Adding the Date Panel 56<br />

Adding the New Entry Panel 58<br />

Adding the Settings Panel 60<br />

Putting It All Together 62<br />

Customizing jQTouch 64<br />

What You’ve Learned 67<br />

5. Client-Side Data Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

localStorage <strong>and</strong> sessionStorage 69<br />

Saving User Settings to localStorage 70<br />

Saving the Selected Date to sessionStorage 73<br />

Client-Side Database 74<br />

Creating a Database 75<br />

Inserting Rows 78<br />

Selecting Rows <strong>and</strong> H<strong>and</strong>ling Result Sets 82<br />

Deleting Rows 86<br />

What You’ve Learned 89<br />

6. Going Offline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91<br />

The Basics of the Offline Application Cache 91<br />

Online Whitelist <strong>and</strong> Fallback Options 94<br />

Creating a Dynamic Manifest File 98<br />

Debugging 102<br />

The JavaScript Console 103<br />

The Application Cache Database 107<br />

What You’ve Learned 113<br />

7. Going Native . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115<br />

Intro to PhoneGap 115<br />

Using the Screen’s Full Height 121<br />

Customizing the Title <strong>and</strong> Icon 123<br />

Creating a Startup Screen 130<br />

Installing Your App on the <strong>iPhone</strong> 131<br />

Controlling the <strong>iPhone</strong> <strong>with</strong> JavaScript 136<br />

Beep, Vibrate, <strong>and</strong> Alert 136<br />

Geolocation 140<br />

Accelerometer 146<br />

viii | Table of Contents

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!