Quantcast
Channel: Developer Feed - Snippet
Viewing all articles
Browse latest Browse all 178

How to create and load URL in UIWebview in iOS?

$
0
0
  1. // NSURL class is used to create an object which will hold the URL information.
  2.  
  3. // NSURLRequest is used to create a request to the URL.
  4.  
  5. // Method loadRequest of UIWebView is used to load the request in the UIWebView.
  6.  
  7.  
  8. -(void)viewDidLoad {
  9.  
  10. UIWebView *webView =[[UIWebViewalloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)];
  11.  
  12. webView.scalesPageToFit= YES;
  13.  
  14. NSString *urlAddress = @”http://www.google.com”;
  15. //Create a URL object.
  16. NSURL *url =[NSURL URLWithString:urlAddress];
  17. //URL Requst Object
  18. NSURLRequest *requestObj =[NSURLRequest requestWithURL:url];
  19. //Load the request in the UIWebView.
  20. [webView loadRequest:requestObj];
  21.  
  22. }

Viewing all articles
Browse latest Browse all 178

Trending Articles