Post

iTip - A Tip Calculator for the iPhone

UPDATE: We have a new and improved tip calculator. Get details and download the best iPhone tip calculator available.

Last night I coded up a simple tip-calculator for the iphone using the 'web sdk.' It's very basic and allows you to easily calculate the tip and figure out how to split a bill between multiple people. It was mostly a learning exercise but it turns out to be somewhat useful. Add it to your bookmarks for easy access on the go.

  • The iphone uses a strange meta tag called a viewport to determine if content should be scaled.
  • You need to use the style default-width; and default-height to get the window to fill the screen.
  • If you give text fields special names like 'zip' you'll get a number mode keyboard if you use 'mobile' you'll get a telephone input keyboard. (no longer true)
  • Since the iphone has no text selection model there seems to be no way to move the text input cursor. I wanted to use the 'telephone pad' for all numeric input and then auto- place the decimal point into but I couldn't get Safari to behave.
  • Webkit has some nice effects like rounded rectangles, shadows and more. Too bad it's not part of all modern web browsers.
  • You can get the Address bar to disappear by placing an onload event on the body:
    onload="setTimeout(function(){ window.scrollTo(0, 1);}, 1)"
    Note: This only seems to work if the window is large enough to scroll.
  • The EDGE network is slow enough without needing to load external files. Minimizing external calls to import CSS and Javascript and things will load faster, especially for one-page applications like this one.
  • Hope you like it. If you have tips for my tip-calculator leave comments.
UPDATE: We have a new and improved tip calculator. Get additional details and download the best iPhone tip calculator.
This post is licensed under CC BY 4.0 by the author.
Letters to the editor

Comments