PDA

View Full Version : [OPEN-122] Rotation issue with Ext.Viewport.scrollToTop and iPhone 3G



afry
3 May 2011, 2:44 PM
I have a Sencha Touch app that displays fine in portrait orientation. When going to landscape, the screen splits in half, the tabBar gets detached, and content from another tab appears on the bottom half of the screen. This only happens on iPhone 3G; tests fine on Android and iPad. See screenshots attached.

SimonFlack
5 May 2011, 11:27 PM
I am experiencing the same bug. When I rotate my apps that use a TabPanel as the main viewport/shell the tabbar appears half way up the screen as in the images above. If I load the app in landscape than everything looks right.

I have posted this issue before but no one could help. This must be a bug.

SimonFlack
6 May 2011, 11:01 AM
After hours of trying everything.

This seems to fix the problem for me...


Ext.Viewport.scrollToTop = function(){
window.scrollTo(0, 1);
}

...it is originally defined as



function () {
if (Ext.is.iOS) {
document.body.scrollTop = document.body.scrollHeight;
}
else {
window.scrollTo(0, 1);
}
}

jnw
19 May 2011, 6:01 PM
I'm seeing the same issue. Where did you put that code? In the TabPanel? Or elsewhere?

Thanks

SimonFlack
19 May 2011, 11:22 PM
At the top of my index.js file.

jnw
20 May 2011, 4:49 AM
Thanks much Simon. That worked for me too!

Bodekaer
22 May 2011, 6:16 AM
Fixed it here as well.
Thanks for sharing.

afry
23 May 2011, 9:39 AM
That worked, thanks.
I tried setting the coordinates to 0, 0 to remove the row of white pixels at the bottom of the screen in landscape mode. This worked on iOS, but for some reason on Android, it made the address bar persist.
At this point the white line is the lesser of evils.
Thanks again.

johax
31 May 2011, 5:59 AM
Yes, this helped me also, had this issue for days now. This fixed it.

Nepol
12 Apr 2012, 8:51 AM
I have the same problem in my app, Im using Sencha Touch 2, Im kind of noob at this: should I put this code on my app.js file? Cause I don't see any index.js, or is it in the SDK? Thanks a lot!