iOS WebView extension beta
This is a beta release of my WebView extension which allows you to embed online content into your app via iOS's built-in UIWebView component.
http://dl.dropbox.com/u/3847822/MMF/WebView_beta.zip
Please see the WebView.htm help file for details and the Browser.mfa file for an example.
Please post any issues you have on this thread. I've only tested it on the simulators and my own iPhone 3GS so far.
Here's the main description from the help file:
"This WebView object allows you to embed online content into your MMF iOS app. You can set its placement and dimensions as you wish in the frame editor, send events to make it load urls, and query it about its loading status (to display "loading..." messages and such). The user can zoom in out and out with gestures, fill out online forms, click links, etc in WebView just like on Safari. Any media files that QuickTime can normally play in Safari will play in WebView as well (with that same 'going to fullscreen' behavior that QuickTime does in Safari). Some HTML5 works correctly in WebView, some not (you'll just have to test).
Caveats: iOS UIWebView, which is what this extension invokes, is a little slow and limited compared to iOS Safari, so for just sending someone to your site, for example, you're better off using the MMF iOS Object's "Open URL" action, even though it takes the user out of your app (the user will be able to bookmark your site in Safari, for instance). Likewise, a https:// connection requiring login or other authentication is better handled through iOS's Safari browser. Some JavaScript does not work in UIWebView. UIWebView does not offer identification that all sites understand, so a site may serve up limited content. So it's not a great idea to use WebView for general web-browsing. *But* if there's some specific web content you want to display in your app, it may be of good use to you.
On the PC side within MMF, the extension is basically just a shell to allow you to place and size the WebView window in your frame, and to attach events to it. It has no functionality when run on a PC. You can see it in action once you've built your app's XCode project and are running it in a simulator or iOS device.
A Browser.mfa showing a basic web browser is included as an example of WebView's functionality, not as an example of a good browser. ;)."
Re: iOS WebView extension beta
Thanks, I will test it out :)
Re: iOS WebView extension beta
Nice! Will have to check it out.
Re: iOS WebView extension beta
Great work! I haven't tested yet, but I imagine this will be a great help to many devs.
Re: iOS WebView extension beta
I got an exciting idea for what this could be used for... :D
Re: iOS WebView extension beta
Thanks, all! Anyone have a chance to try it out yet? Any issues?
Re: iOS WebView extension beta
Hey, I haven't had a chance to play around with this yet. But is there a way that it can just load read-only page? As in the user cannot scroll around in it or zoom?
I want to put maybe like a small news feed on the title screen. Also, does this test for an internet connection? Let's say someone is using an iPod Touch with no current internet access, can I change what it says in the webview extension?
Re: iOS WebView extension beta
I think I can add some actions to enable/disable zoom (would toggle the UIWebView's scalesPageToFit property) - I can test that soonish. I don't think there's a way to disable scrolling, but I think if the content "fits" the view completely, there should no scrolling - so you can try to style the content and shape the webview to achieve that.
As for a message if there's no internet connection, yes, there is a "Did WebView fail to load a url?" condition you can use to respond in whatever way you wish to the webView not being able to load the requested url.
Except, you can't explicitly set WebView to display a string, it'd have to be some external string or graphic object, etc outside of the WebView (this is shown in the browser example) that indicates the loss of connection to the user. But...UIWebView is apparently able to load documents from the appbundle as well, so theoretically you could make a custom "Sorry, no internet" html page, and then load it into the WebView for that condition, but I haven't played around with document loading at all yet.
Re: iOS WebView extension beta
I'm actually working on a kind of educational quiz app that links you to a relevant wikipedia page after an answer. This extension is *ideal* for what I need for this project.
One thing though, I've got it working and everything, but I can't seem to zoom and in the default view it gives me, the text is too small to read. Being able to have a default zoom value if that's possible would be great for what I need too.
If you could develop this to where I can use it for this project, I'd be happy to send some money your way :)
Re: iOS WebView extension beta
colej_uk, yes I've noticed some sites (especially the mobile version of some sites) disable zoom somehow. I've been reading about a workaround for that which I'll attempt to add to the extension soon.