UIWebView is to display html content and other documents, e.g., pdf, inside iPhone App. It has three methods to load content to the view:
- loadData:MIMEType:textEncodingName:baseURL: – loadHTMLString:baseURL: – loadRequest:Both content from remote server and local file can be loaded. By setting the delegate of the UIWebView instance, we can intercept the click actions on the view. For example,
– webView:shouldStartLoadWithRequest:navigationType:can will be called whenever a request is to be sent from the html, i.e., a hyperlink is clicked. In this case, we can customize the click action(the target should be a link anchor) to segue to another view controller. We can also change the content of the view by calling javascript code:
– stringByEvaluatingJavaScriptFromString:
No comments:
Post a Comment