I am developing an app where there is a requirement under which there is show wikipedia link in Web
view.and also there is showing history of pages open via web view in a table view.I have find it on goo
gle but can't find any solution.How can I solve it?
Following code for the backward and forward into UIWebViewController
- (IBAction)backButtonClicked:(id)sender {
[webView goBack];
}
- (IBAction)backButtonClicked:(id)sender {
[webView goForward];
}
Paresh Navadiya
UIWebView has goBack and goForward method. Refer [here].(http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html)
Don't forget to add UIWebViewDelegate in .h and its object delegate to self.
Also can store url in NSMutableArray like this:
- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *documentURL = request.mainDocumentURL;
if(![history containsObject:documentURL.absoluteString]){
[arrBrowseHistory addObject:documentURL.absoluteString];
}
}
来源:https://stackoverflow.com/questions/12638683/how-to-save-browsing-history-of-uiwebview