Sunday, September 16, 2012

Developer notes : UIWebView Class

This post contains a summary of the UIWebView class reference for iOS. I'm not going about this in detail. This post contains information about the UIWebView class that I think are worth making a note of. Also, this information is not for beginners. If you are new to iOS/Objective C/UIWebView go here .

  • Use the loadRequest: method to begin loading web content, the stopLoading method to stop loading, and the loading property to find out if a web view is in the process of loading.
  • Use the goBack and goForward methods as actions for forward and back buttons. Use the canGoBack and canGoForward properties to disable/enable the buttons when the user can’t move in a direction.
  • By default, a web view automatically converts telephone numbers that appear in web content to Phone links.Set the detectsPhoneNumbers property to NO to turn off this default behavior.
  • The delegate property to an object conforming to the UIWebViewDelegate protocol if you want to track the loading of web content.
  • In addition to HTML, the following formats are supported : Excel (.xls), Keynote (, Numbers (, Pages (, PDF (.pdf), Powerpoint (.ppt), Word (.doc),Rich Text Format (.rtf), Rich Text Format Directory (, Keynote '09 (.key), Numbers '09 (.numbers), Pages '09 (.pages)
  • loadData:MIMEType:textEncodingName:baseURL: can be used to set the main page contents, MIME type, content encoding, and base URL.
  • UIWebViewNavigationType enum contains the user actions encapsulated. This can be used to track user actions.
  • For creating HTML content for iOS read this.
  • The webkit used by the browser is not equal to the webkit used by UIWebView. A word of caution.
It feels good to be back after a long long time.

Thanking you,