Framework Features
The iUI framework consists of a mixture of CSS styles and Javascript functions. These provide a set of style selectors that you apply to your page's HTML elements. The framework then uses Javascript to manipulate the page's document tree to modify its look. The appearance and behavior of these modified elements mimics that of the iPhone UI. For example, an ordered list of hyperlinks becomes the familiar iPhone list with arrows used to jump to other pages of a program.
There are style selectors for setting up a navigation bar, lists, and hyperlinked lists of information. Other styles help construct panels that contain controls, display information, or provide buttons.
Other iUI features that assist you with writing iPhone web pages are:
- Visual feedback. Some elements flash briefly with the same blue color as the iPhone UI, thus verifying that the element has responded to the user's tap.
- Conserve screen space. At the top of an iPhone web page is a bar that displays the page's URL. This URL text field bar consumes a precious 60 pixels of vertical screen real estate. You can temporarily hide the URL by invoking this code:
<body onload="setTimeout(function() { window.scrollTo(0, 1) }, 100);"></body>
This lets you recover those 60 pixels. iUI calls this code for you automatically. - Handles changes in screen orientation. If the user flips the iPhone on its side, this action generates a change in orientation event that iUI responds to by re-rendering the web page with the new screen dimensions.
To use iUI, you reference its CSS styles file (iui.css), and Javascript functions file (iui.js) inside your web page's header, bracketed by the appropriate <javascript> and <style> tags.
To recap, you write your iPhone page using HTML elements and tag them with iUI styles. After you put the interface together, you then write your own Javascript functions that carry out the page's intent. When the page executes on the iPhone, it looks and behaves like an iPhone app, thanks to the iUI framework.