Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Use <code>UIWebView</code>. Set the delegate to the view controller.</p> <pre><code>self.webView.delegate = self; </code></pre> <p>Other remarkable properties,</p> <pre><code>self.webView.scalesPageToFit = YES; </code></pre> <p>To load a URLRequest,</p> <pre><code>[self.webView loadRequest:theRequest]; </code></pre> <p>or for only strings, use</p> <pre><code>[self.webView loadHTMLString:htmlString baseURL:nil]; </code></pre> <p>And some delegates here. web view has its own history, you can use it by calling its back and forward methods.</p> <pre><code>#pragma mark - UIWebView delegate // You can handle your own url scheme or let the web view handle it. - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSLog(@"url=%@, %@, %@", request.URL, request.URL.query, request.URL.host); if (navigationType == UIWebViewNavigationTypeLinkClicked) { if ([request.URL.scheme compare:@"customescheme"] == NSOrderedSame) { if ([request.URL.host compare:kSomethingDotCom] == NSOrderedSame) { [self mymethod]; } else if ([request.URL.host compare:kAnotherDotCom] == NSOrderedSame) { [self method2]; } else { NSLog(@"Unsupported service."); } return NO; } } return YES; } - (void)webViewDidFinishLoad:(UIWebView *)webView { [_activityIndicator stopAnimating]; } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { [_activityIndicator stopAnimating]; [Resources showAlert:@"Could not load." withTitle:@"Error!"]; NSLog(@"%@", [error localizedDescription]); } #pragma mark - Actions - (IBAction)didPressBackButton:(id)sender { [_webView goBack]; } - (IBAction)didPressForwardButton:(id)sender { [_webView goForward]; } </code></pre> <p>Similarly you can have the stop method. To refresh reload the request again. Before going back or forward you can check the methods canGoBack or canGoForward. See docs at, <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html" rel="nofollow">http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload