Frameworks like Phonegap (Cordova) allow you to develop your entire app using HTML/Javascript. However, there are definite overkill if you’re looking to develop your apps in Objective-C, but want to use a UIWebView for a few specific instances.
I’ve previously mentioned the UIWebview Javascript bridge that allows you to communicate with a webview through your Objective-C code which is great for this purpose..
Today I came across another library that takes things a step further providing a number of extremely useful features (including some I have never seen in a similar library).
These features include:
- selector methods for interacting with commonly used Javascript functions and DOM interfaces.
- error handling (Javascript errors are returned as NSError objects)
- the ability to communicate directly with Objective-C objects from Javascript
- callbacks from Objective-C to Javascript
The library is GAJAvascript from Andrew Goodale.
You can find GAJavascript with examples and documentation on Github here.
A great method for those times when it’s easier to use a UIWebView.
©2012 iPhone, iOS 5, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.
.





