开发者

Titanium Appcelerator orientationchange doesn't occur

I have a problem with orientationchange in titanium appcelerator. When moving between tabs, the orientationchange event is not fired when switching between portrait & landscape.

Here's my code

Titanium.Gesture.addEventListener('orientationchange', function(e){

    var alertDialog = Ti.UI.createAlertDialog({
        title: "Alert",
        message: "Orientation is "+  e.orientation,
        buttonNames: ['OK'],
        cancel:0
    });
    alertDialog.show();

});

Here's the reproduction steps:

  1. Switch to tab 2, and then enter landscape mode(alert appears).
  2. Switch back to tab 1, rotate phone into portrait mode(alert doesn't appear).
  3. The event does not occur. (Subsequent events fire as usual(alert appears))

Anyone have an idea on a work-around? I need that because I have to change view onorientationchan开发者_运维问答ge. I'm using Titanium Appcelerator 1.2.2, mobile version 1.6, Api 2.2


nevermind

EDIT: I found a workaround http://developer.appcelerator.com/question/74781/orientationchange-is-never-fired


Ti.Gesture.addEventListener('orientationchange', function(e){

var alertDialog = Ti.UI.createAlertDialog({ 
    title: "Alert", message: "Orientation is "+ e.orientation, buttonNames: ['OK'], cancel:0 }); alertDialog.show();

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜