Building iPhone apps with html css and JavaScript

Source: Internet
Author: User

Source: http://adamlu.com /? P = 344

The three main technologies used to write iPhone web apps are HTML, CSS, and Javascript. They do not need to be installed on the iPhone or written in objective-C, therefore, it is relatively easy to get started with the front-end. Compared with native apps, Web apps have a fast development cycle and can run in any web browser, not just on Mac OS, the disadvantage is that you cannot access some hardware features of the iPhone and it is difficult to achieve some advanced UI effects.

There are some notes:

1. Prepare an iPhone style sheet
<LINK rel = "stylesheet" type = "text/CSS" href?”iphone.css "Media =" only screen and (max-width: 480px) "/>

2. Control page scaling. If this parameter is not specified, the iPhone determines that the webpage width is 950px.
<Meta name = "viewport" content = "user-scalable = No, width = device-width"/>

3. Add the Home Page icon. If you want to add a shortcut from your web app to the home page, you need to specify an icon. There are two options:
<LINK rel = "apple-touch-icon" href?”mycustomicon.png "/>
<LINK rel = "apple-touch-icon-precomposed" href?”mycustomicon.png "/>

4. Full Screen mode
<Meta name = "apple-mobile-web-app-capable" content = "yes"/>

5. Status Bar
<Meta name = "apple-mobile-web-app-status-bar-style" content = "black"/>

6. Customize the startup image. The size of this PNG image is 320px x 460px.
<LINK rel = "apple-touch-startup-image" href?”mstartupgraphic.png "/>

7. Use jqtouch for animation
Jqtouch is a jquery-based mobile Web development plug-in,: http://jqtouch.com/

8. Use HTML5 to store client data
HTML5 provides localstorage, sessionstorage and client database

9. Use HTML5 to implement offline applications
Offline applications need to store a manifest file on the server, and then <HTML manifest = "demo. manifest ">, if you are using Apache or other Web servers, you need to add. the htaccess file is in the directory of your website. The content in the file is addtype text/cache-manifest. manifest
The file format of manifest is as follows:
Cache manifest
Index.html
Scripts/demo. js
Styles/screen.css
Network: ----> fallback:
Logo.jpg ----> logo.jpg offline.jpg
Network indicates the online file whitelist. If you are offline, this image will not be displayed. If you want to replace this image with other images, you can change it to an arrow.

10. UsePhonegapTurn your web app into a native app
Phonegap is an open-source development tool that connects web applications and mobile devices.

For more information, see the book "Building iPhone apps with HTML, CSS, and JavaScript" and cloud Qian's "Web Front-end development on iPhone ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.