Skip to content

Instantly share code, notes, and snippets.

@samchandra
Created September 22, 2010 08:30
Show Gist options
  • Save samchandra/591363 to your computer and use it in GitHub Desktop.
Save samchandra/591363 to your computer and use it in GitHub Desktop.
Creating transparent UIWebView as UITableViewCell
// Creating UITableView Cell
// Transparent UIWebView
CGRect cellFrame = CGRectMake(0, 0, 320, 100);
cell = [[[UITableViewCell alloc] initWithFrame:cellFrame] autorelease];
CGRect labelFrame = CGRectMake(5,5,310,90);
UIWebView *textWebView = [[[UIWebView alloc] initWithFrame:labelFrame] autorelease];
textWebView.backgroundColor = [UIColor clearColor];
[textWebView setOpaque:NO];
NSString *content = @"<html><body style=\"background-color: transparent; color:#FFFFFF\">There is damage that often hurts us more than the vehicle itself; small blemishes on the exterior and in the interior which simply cannot be avoided over the course of the vehicle's life. In many cases such damage can be fixed with very little fuss - and without replacing entire parts.</body></html>";
[textWebView loadHTMLString:content baseURL:nil];
[cell addSubview:textWebView];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment