Displaying an image inside a container

This recipe explains how to load an image on the iPhone screen. Normally, images have different sizes and we need to adjust it for loading each image inside a specific container or element in our web page. The process for taking this action is straightforward, thanks to the iWebKit framework.

The different files required by this recipe can be found at: code/ch04/display/ in the code bundle provided on the Packtpub site.

Getting ready

We'll use the iWebKit framework for this recipe. Be sure you have this framework ready to use.

How to do it...

  1. Open your favorite text editor and create a new file called display.html. The main lines of code will be the following:
    <link href="../iwebkit/css/style.css" rel="stylesheet" ...

Get iPhone JavaScript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.