![](/img/trans.png)
[英]Appcelerator Titanium Alloy: How to store data on a ScrollableView to use in click event
[英]how to use postlayout in titanium (Alloy )imageview
在Titanium 3.x(Alloy)中使用后布局的示例代碼:
視圖:
<Alloy>
<Window class="container">
<Label id="testLabel" onClick="doClick">Hello, World</Label>
<ImageView id="testImgView" autoStyle="true" ></ImageView>
</Window>
</Alloy>
控制器:
$.testLabel.addEventListener('postlayout', function(e) {
Ti.API.info('Label postlayout working!');
});
$.testImgView.image='default.png';
$.testImgView.addEventListener('postlayout', function(e) {
Ti.API.info('Img postlayout working!');
});
$.index.open();
結果:
[INFO][TiAPI ( 2188)] Label postlayout working!
沒錯,我剛剛在Android上嘗試了您的代碼,但它不適用於3.1.3GA版本。 它一定是一個錯誤。
如果您覺得這不方便,可以使用
<View id="testImgView" autoStyle="true" ></View>
和
$.testImgView.backgroundImage='/default.png';
它會起作用
或者您可以在此處創建問題
編輯
我已經在iPhone Simulator SDK 6.1上嘗試過,它可以很好地觸發imageView postlayout事件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.