I have recently gotten my first iphone web app working and wanted to
share my experiences and also hopefully get some feedback. My app is
a (killer) sudoku player. (See it at:
www.killersudokuonline.com/iphone) The 9x9 grid along with the
information about sums, etc. means that zooming in and out is pretty
much required. Given the lack of (predictable) events/functions for
manipulating the phone (e.g., ondoubleclick, ondrag, onresize,
rescaleto, etc.) I am stuck allowing the user to resize the screen.
Here is what I learned:
- Too many timer functions really slows the phone down. You will
notice if you look at the player that the pop-up keyboards fad out.
I initially had a timer do this, but combined with the timer
checking for screen resizing, this lead to poor ui response.
- changing the viewport meta tag will rescale the page, but it ONLY
does so for the text that is flowing. That is, if a DIV or IMG has
absolute scaling, it won't touch it. Bummer. I thought this hack
was going to solve my problems. Alas. If anyone gets this to work
with an image on the screen (that is absolute positioned), please
let me know :) You can see what did work at:
www.killersudokuonline.com/iphonehacks/test1.html.
Here are some questions I have:
- (For Joe Hewitt, I guess, but anyone else who knows, please help
out.) Why is the scrollTo wrapped in a timer function, in the
updateLayout function: e.g., From code posted earlier by other
people:
function updateLayout() {
var iw = window.innerWidth;
var ih = window.innerHeight;
if ((iw != currentScreenWidth)||(ih != currentScreenHeight)) {
currentScreenWidth = iw;
currentScreenHeight = ih;
var scrOfY = window.pageYOffset;
var scrOfX = window.pageXOffset;
if (scrOfY == 0) scrOfY = 1;
setTimeout(function() { window.scrollTo(scrOfX, scrOfY); },
50);
}
}
you will notice this code is different than the original code,
because I allow the user to scroll the page. This means it can be
resized in both directions, and I still want to hide that ugly top
bar.
Question: Why not scrollTo right here in this event function?
- I would appreciate any feedback about how to improve the player.
- also, if anyone has found a reliable way to scale the window under
program control, please post it here! My attempt
(www.killersudokuonline.com/iphonehacks/test1.html) looked
promising, but failed when I had an image on the screen, etc.
Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---