O'Reilly logo

iPhone JavaScript Cookbook by Arturo Fernandez Montoro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required