Disadvantages:
Advantages:
Must know Objective-C
Access native features
Need Mac and OSX Leopard
camera
location awareness Give up first born child in
3D support mountain of legal agreements
accelerometer (fine grain)
Must have application
off-line access
approved and vetted before
Performance
distribution in App Store
Process is on Apple’s timeline
not yours
Advantages: Disadvantages:
Develop with Server-side Don’t have access to
technology of choice native features
Java Not as glamorous
Groovy/Grails
Network performance
Ruby
.NET
PHP
Perl
Don’t have to deal with
syncing data with cloud
Deployment and schedule
is under your control
Easier to deal with versioning
Incompatible Websites
No plug-in support
Avoid
No mobile
HTML Frames
technology support Absolute positioning
Mouse and keyboard events
XHTML Mobile Profile (MP)
WAP 2.0
WAP/WML
There is not much Mobile Safari
doesn’t support
• Web Application Framework
• Development Environment
• Open Source under Apache 2.0 License
• Current version 1.0.4 (1.1 is around the corner)
• Best Practices
Convention over configuration
–
Don’t repeat yourself (DRY)
–
Default is what you expect (DIWYE)
–
Agile
–
Scaffolding
–
AJAX
–
Plug-ins
–
Unit testing
–
Web Services
–
Scaling
Default width is 980 Custom Viewport
and scaled down by 2:1 or 3:1
<meta name=quot;viewportquot;
content=quot;width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;quot;>
iUI
Provide a native iPhone application look and feel
Open Source library containing
Cascading Style Sheets (CSS)
JavaScript
Images
http://code.google.com/p/iui/
Transitions Lists Forms
iUI is AJAX
ommonly implemented as a single page
Named anchors URLs transition to named elements
Standard URLs make AJAX requests to server for snippet
Full page requests must use target of _self
Get more URLs must use target of _replace
Setting up iUI
1.Download tar
2.Uncompress
3.Copy images, iui.css, iui.js and iuix.js to web project
4.Import iui.css and iui.js
<html>
<head>
<title>Note List</title>
<style type=quot;text/cssquot; media=quot;screenquot;>@import quot;/mynotes/js/iui/iui.cssquot;;</style>
<meta name=quot;viewportquot;
content=quot;width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;quot;>
<link rel=quot;apple-touch-iconquot; href=quot;/mynotes/images/apple-touch-icon.pngquot;/>
<script type=quot;text/javascriptquot; src=quot;/mynotes/js/iui/iui.jsquot;></script>
<script type=quot;text/javascriptquot; src=quot;/mynotes/js/application.jsquot;></script>
</head>
<body>
<!-- code removed for brevity -->
</body>
</html>
Toolbar
<html>
<head>
<!-- code removed for brevity -->
</head>
<body>
<div class=quot;toolbarquot;>
<h1 id=quot;pageTitlequot;></h1>
<a id=quot;backButtonquot; class=quot;buttonquot; href=quot;#quot;></a>
<a href=quot;/mynotes/note/createquot; class=quot;buttonquot;>+</a>
</div>
</body>
</html>
Manages state and history
List
<html>
<head>
<!-- code removed for brevity -->
</head>
<body>
<div class=quot;toolbarquot;>
<h1 id=quot;pageTitlequot;></h1>
<a id=quot;backButtonquot; class=quot;buttonquot; href=quot;#quot;></a>
<a href=quot;/mynotes/note/createquot; class=quot;buttonquot;>+</a>
</div>
<ul id=quot;notesquot; title=quot;Notesquot; selected=quot;truequot;>
<li><a href=quot;/mynotes/note/show/46quot;>Grocery list</a></li>
<li><a href=quot;/mynotes/note/show/47quot;>Chrismas wish list</a></li
<li>
<a href=quot;/mynotes/note/more?offset=8quot; target=quot;_replacequot;>
Show 8 More Notes...
</a>
</li>
</ul>
</body>
</html>
Just an HTML unordered list
Grails iUI Plug-in
A plug-in for simplifying using iUI with Grails.
http://grails.org/iUI+Plugin
iPhone layout
iUI CSS, JavaScript and images
grails install-plugin iui Grails apple-touch-icon
Automatically uses optimized
JavaScript in production mode
Determine iPhone
User-Agents
iPhone - Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML,
like Gecko) Version/3.0 Mobile/4A93 Safari/419.3
iPod Touch - Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1
(KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3
Use Regular Express - Mobile.*Safari
class IPhoneFilters {
def filters = {
all(controller:'*', action:'*') {
before = {
if (request.getHeader(quot;User-Agentquot;) =~ quot;Mobile.*Safariquot;)
request['fromIPhone'] = true
}
}
}
}
Resources
Web Development Guidelines for the iPhone (Safari Web Content Guide for iPhone OS)
- https://developer.apple.com/webapps/docs/documentation/AppleApplications/Reference/SafariWebContent/
Safari HTML Reference
- http://developer.apple.com/documentation/AppleApplications/Reference/SafariHTMLRef/
Safari CSS Reference
- http://developer.apple.com/documentation/AppleApplications/Reference/SafariCSSRef/
WebKit DOM Programming Topic
- http://developer.apple.com/documentation/AppleApplications/Conceptual/SafariJSProgTopics/