Skip to content

Phonegap + Sencha : orientation change solution


Si comme nous vous êtes entrain de déployer des applications iPad, une solution intéressante et permettant la réalisation plus rapide d’application basique est envisageable. Utiliser : Phonegap et Sencha Touch. Seul petit problème le UIWeb composant de Xcode ne gère pas les changements d’orientation. Voici donc la solution :

[code]Ext.setup({
onReady: function() {
panel = new Ext.Panel({
fullscreen: true,
layout: ‘card’,
items:[{xtype:’panel’,contentEl:’portrait-container’,scroll:’vertical’},
{xtype:’panel’,contentEl:’landscape-container’,scroll:’false’}]
});
Ext.EventManager.onWindowResize(setActivePanel);
}
});

function setActivePanel(){
panel.setOrientation( Ext.getOrientation() , window.innerWidth , window.innerHeight );
};[/code]

Voir notre post sur Sencha : Phonegap + sencha orientation

3 Comments

  1. m7o

    thanks a lot for this solution, but didn’t you also have the problem that this only works once? On the next orientation change the content does not redraw, at least in my tests.

  2. m7o

    By the way, here is a thread concerning this problem, where I already added your wisdom:
    http://bit.ly/au1cR9

  3. no problem for us when we use this script on sencha + phonegap using. Orientation change are not fire on ipad and iphone phonegap uiwebcomponent. You must use : onWindowResize the simulate onOrientationChange.

    Best regards

Commentaires fermés.