2015-04-15 43 views
1

钛中的动画不会更改视图的坐标。那么改变视图的坐标(例如顶部)然后跟踪其位置的最好方法是什么?更改钛上的坐标视图

var t1 = Ti.UI.create2DMatrix(); 
var a1 = Ti.UI.createAnimation(); 
t1 = t1.translate(0, 10);//Translate on y coordinate 
a1.transform = t1; 
a1.duration = 800; 
view.animate(a1); // Move the view, but the top property keeps the same 

谢谢,如果它是一个愚蠢的问题对不起!

回答

0

animate()方法不会因为原因而更改任何坐标。

topleftrightbottom是布局机制所必需的。

更改顶部坐标的最简单方法就是像这样设置它。

$.getView().applyProperties({ 
    top: newTopValue 
}); 

并设置后,它会自动触发布局重新计算