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:
- Switch to tab 2, and then enter landscape mode(alert appears).
- Switch back to tab 1, rotate phone into portrait mode(alert doesn't appear).
- 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();
});
精彩评论