Home Tutorial Iphone Examples UIWebView Background Color

 
 

Share on Google+Share on Google+
UIWebView Background Color
Posted on: August 9, 2010 at 12:00 AM
Advertisement
If you wanted to change the background color on UIWebView in iPhone SDK, then you required to set the background color of UIWebView using UIColor.

UIWebView Background Color

If you wanted to change the background color on UIWebView in iPhone SDK, then you required to set the background color of UIWebView using UIColor. UIColor object represents color and opacity (alpha value). Where as setBackgroundColor will allow you to change the color of background area of UIWebView or UIView.

This example illustrate you how to change the color of UIWebView in iPhone SDK based application. To change the color of background first we need to set the backgroundcolor as clearColor and then set the required color to it as given in the following code.

- (void)viewDidLoad {
[super viewDidLoad];

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com/"]]];

//Set the UIWebView background color and opaque:NO
[webView setBackgroundColor:[UIColor clearColor]];
[webView setBackgroundColor:[UIColor purpleColor]];

[webView setOpaque:NO];

}

On running the application you'll find the output similar to give image.

Download Code

Advertisement

Related Tags for UIWebView Background Color:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com