1
是否有可能爲我的應用程序中的所有元素(imageViews,coverflow等)使用默認的「defaultImage」?這將是偉大的,而不是把「defaultImage」無處不在...鈦:如何爲所有元素設置默認的「defaultImage」?
我已經取代了名爲「photoDefault.png」在sdk_VERSION/iphone /模塊/ ui /中的圖像,但我不認爲這是最好的招...
謝謝
是否有可能爲我的應用程序中的所有元素(imageViews,coverflow等)使用默認的「defaultImage」?這將是偉大的,而不是把「defaultImage」無處不在...鈦:如何爲所有元素設置默認的「defaultImage」?
我已經取代了名爲「photoDefault.png」在sdk_VERSION/iphone /模塊/ ui /中的圖像,但我不認爲這是最好的招...
謝謝
如果您使用的合金框架,你能做到這樣,只是在你的app.tss定義一個全局視圖風格:
"ImageView" : {
defaultImage : 'yourDefaultImage.png'
}
所有圖像的意見會現在有這個默認背景圖像,除非你在代碼中覆蓋它。
如果你不想用合金,只是這樣做,而不是:
Titanium.UI.createImageView = Ti.UI.createImageView = function(attributes) {
attributes.defaultImage = 'yourDefaultImage.png';
var self = Titanium.UI.createImageView(attributes);
return self;
}
這只是重新分配鈦命名空間不同的功能,與您的自定義默認圖像包裹createImageView
。
感謝您的答案:),但我不使用Alloy,並且您的方法使用backgroundImage而不是defaultImage參數。 – RelevantUsername 2013-04-30 14:31:50
那麼,使用合金:)我更新了默認圖像的答案,並添加了一種方法來做到這一點,沒有合金 – 2013-04-30 16:41:42