【问题标题】:sencha touch app layout does not change to landscapesencha touch 应用程序布局不会更改为横向
【发布时间】:2013-03-11 14:24:36
【问题描述】:

我有一个使用 sencha touch 的基本应用程序,可以将用户从一个视图带到另一个视图。当我出于某种原因将模拟器更改为横向时,它的布局保持不变,仍然显示为纵向。我该如何改变这种行为?

【问题讨论】:

  • 不确定为什么它不会切换,但您可以将处理程序附加到 ST2 中的 orientation 事件,以查看它是否正在触发。阅读orientation in native apps here 上的文档。

标签: javascript extjs sencha-touch sencha-touch-2


【解决方案1】:

在视口上添加orientationchange事件:

initialize: function () {
    // Add a Listener. Listen for [Viewport ~ Orientation] Change.
    Ext.Viewport.on('orientationchange', 'handleOrientationChange', this, {buffer: 50 });
    this.callParent(arguments);
},
handleOrientationChange: function(){
    console.log('handleOrientationChange');
    // Execute the code that needs to fire on Orientation Change.
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    • 1970-01-01
    • 2013-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多