I have two title images of 768 and 1024 width for portrait and landscape orientation. But sometimes (when navigate to previous view) the images not make change when orientation change.I am using following code:
Ti.UI.orientation = Titanium.Gesture.orientation;
Titanium.Gesture.addEventListener('orientationchange', fu开发者_运维知识库nction(e) {
w.barImage = 'null';
//alert("Orientation Change"+o);
var o = Titanium.Gesture.orientation;
if(o==1||o==2)
{
w.barImage='barImage768.png';
w.add(navBar);
}
else if(o==4||o==3)
{
w.barImage='barImage.png';
w.add(navBar);
}
});
Anybody have solution for that. Sometimes I get 0 orientation in alert.
It is possible to get orientation values of 0 for unknown and 5 or 6 when the device is facing up or down.
It worked for us to keep track of the last "real" orientation value (values of 1, 2, 3, or 4) and continue to use that when a value of 0, 5, or 6 is received.
精彩评论