Saturday, August 28, 2010

Nieman Journalism App uses Tyree Apps' OOZWebView

We are happy to note that Joshua Benton and the Nieman Journalism Lab at Harvard have incorporated the OOZWebView into their iPhone application. It is really exciting to know that something we have made open source is actually helpful and valuable.

Now the whole concept of Open Source becomes clearer to us. This great feeling isn't going to feed the kids, but it's pretty powerful and we've already had a few inquiries about paying gigs based on publicity we've gotten through our Open Source work.

Based on Joshua's work with out plugin we've made some changes and found a bug. The bug occurred when the plugin was used in offline mode and has now been fixed in the github repository for the plugin. One of the things that Joshua added to our codebase was a command to scale the web pages. Originally, when one would load a webpage, the first page would look fine and then any future pages had the potential to look too big. So he suggested that we add a line in the ConnectionDidFinishLoading method (line 158 of the OOZWebView.m file) to allow the page to resize:

[self.webView setScalesPageToFit:YES];

However, when we did add that code it resized our initial page as well. Now the initial page would shrink to fit itself onto the screen rather than staying at the original size. It was a simple matter of setting a viewport command in the meta data of the html controlling the initial page to rectify the situation.

By setting the viewport, we are telling the iPhone how to scale the content of the website. Apple has an excellent developer article about viewports and Safari and the iPhone. However, if you're the impatient type, try sticking this code into your html:

<meta name="viewport" content="width=320, user-scalable=yes">

This is a meta command so it needs to go into the "head" section of your html page.

No comments:

Post a Comment