2015-04-15 106 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 
}); 

並設置後,它會自動觸發佈局重新計算