tags:

views:

33

answers:

2

Hi, Can anyone point me some good examples on how to use UIWebView in iPhone.

A: 

here is the code for using UIWebview

Hope this gives you an idea for using it

CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0); 
UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame]; 
[webView setBackgroundColor:[UIColor whiteColor]]; 
NSString *urlAddress = @"http://www.google.com"; 
NSURL *url = [NSURL URLWithString:urlAddress]; 
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
[webView loadRequest:requestObj]; 
[self addSubview:webView]; 
[webView release]; 

hAPPY cODING...

Suriya
Thank you so much!!! This is really easy to understand.
Abhinav
Always welcome... Bt getting a vote is the best thank :-)
Suriya
+1  A: 

Apple has a couple of sample code projects:

UICatalog

Web - Shows how to properly use a UIWebView and target websites using NSURL class.

and

TransWeb

Demonstrates how to implement UIWebView with a transparent background.

Shaggy Frog
Thank you so much!!!
Abhinav