almost 9 years ago
Hi guys,
Today we'll learn how to load a URL in a WebView in iPhone.
Also include the following delegate methods-
-(void)webViewDidStartLoad:(UIWebView *)webView {
NSLog(@"Load view");
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"Finish View");
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"Error in loading: %@", [error description]);
}
Now we simply have to define the URL or the Web address which we want to load in our Web View as-
NSString *urlString = @"https://www.google.co.in";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:urlRequest];
-(void)webViewDidStartLoad:(UIWebView *)webView {
NSLog(@"Load view");
}
-(void)webViewDidFinishLoad:(UIWebView *)webView {
NSLog(@"Finish View");
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"Error in loading: %@", [error description]);
}
Now we simply have to define the URL or the Web address which we want to load in our Web View as-
NSString *urlString = @"https://www.google.co.in";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[myWebView loadRequest:urlRequest];
Hope you understand..thanks for reading..
0 Comment(s)