iPhone Development – Transparant UIWebview and UITableView

A distinct lack of posts recently, mainly because of the huge volume of work I’m getting through. But hopefully that’ll mean lots of juicy tips saved up.

Anyway a very quick one again. It’s often quite nice to have transparent table views, especially with a background image on the parent view. Simply set opaque to NO and set the background colour to clear. This can either be done in Interface Builder by unchecking opaque and choosing 0% opacity on the background colour, or programmatically with:

tableView.opaque = NO;
tableView.backgroundColor = [UIColor clearColor];

Make sure your UITableViewCells also have a clear background, otherwise they’ll obviously block the background.

You can achieve a similar effect with UIWebViews as well. Simply follow the same steps. However an extra complication is you need to include a style in the HTML you load into the webview. So somewhere in your HTML styling you will need to specify:

background-color:transparent

This can either be part of the body style tag or included in a CSS file.

2 responses to “iPhone Development – Transparant UIWebview and UITableView”

  1. Alexander says:

    Need cheap generic VIAGRA?…

  2. Alexander4 says:

    Need cheap generic ABANA?…

Leave a Reply

Your email address will not be published. Required fields are marked *