Book Image

iPhone JavaScript Cookbook

By : Arturo Fernandez Montoro
Book Image

iPhone JavaScript Cookbook

By: Arturo Fernandez Montoro

Overview of this book

<p>Undoubtedly, the iPhone is one of the most exciting mobile devices in the world. Its iOS is used in other Apple devices such as the iPad and iPod Touch. With this book you'll learn how to build and develop applications for these devices without applying Apple's burdensome and at times restrictive technologies. Just use your experience and knowledge combined with web front-end technologies like JavaScript to build quality web apps. Nobody will know you haven't used Objective-C and Cocoa.</p> <p>The <i>iPhone JavaScript Cookbook</i> offers a set of practical and clear recipes with a step-by-step approach for building your own iPhone applications applying only web technologies such as JavaScript and AJAX. Web developers won't need to learn a new programming language for building iOS applications with a native look and feel.</p> <p>The first part of the book introduces you to the world of iPhone applications. Understanding how it works is required for designing good user interfaces for this device. You will continue learning about how to apply multimedia features to your applications. Common features of web applications, such as AJAX and SQL, can also be applied to our iPhone applications. The third part of the book explains how to deal with specific features of iPhone such as the accelerometer. At the end, you learn how to offer additional features through external websites. With the <i>iPhone JavaScript Cookbook</i>, you will be able to develop outstanding web applications with a for Apple's mobile devices, offering your users all of the advantages of the native look and feel.</p>
Table of Contents (17 chapters)
iPhone JavaScript Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Identifying the current location


iPhone, iPod Touch, and iPad share an important feature: All of them are mobile devices. Taking advantage of the built-in GPS sensor, we can identify the device's current location. This kind of information can be very useful for those developers interested in geolocation.

Let's find out how to develop a simple application for retrieving our current location using our mobile iOS device. Our application will display our current location on the screen using the standard latitude and longitude coordinates. This information will be displayed after the user clicks the provided button.

Getting ready

For this recipe, we'll use the UiUIKit framework for building the graphical user interface of our application. Additionally, the XUI framework will be used for manipulating the DOM model of the page for displaying our result. Check to make sure that both the frameworks are installed on your machine.

How to do it...

  1. 1. First, we're going to create an XHTML file with...