在合金项目是一个TiTouchImageView工作? [更新] [英] Is a TiTouchImageView working in an alloy project? [UPDATE]
问题描述
我目前正在开发钛的应用程序为Android和iOS包含ImageView的应该是滚动的,可扩展的(通过滑块)。我已经得到这个工作在iOS,但是在Android上真的很难实现滚动行为。我决定使用 TiTouchImageView 模块,但文档只展示了如何使用它在非-Alloy项目。我现在的code是这样的:
如果(Ti.Platform.osname ==机器人){
VAR TiTouchImageView =需要('org.iotashan.TiTouchImageView');
VAR androidImageView = TiTouchImageView.createView({
顶:0,
左:0,
变焦:originalScaleValue,
maxZoom:originalScaleValue * 2,
minZoom:originalScaleValue,
图片:BLOB,});
$ .androidInnerImageScrollView.add(androidImageView);
} 其他 {
$ .iosPicture.setImage(BLOB);
}
但是,有没有可能通过view.xml用作为合金成分加载此?
编辑:我尝试过使用模块
标签合金:
<滚动型ID =androidInnerImageScrollView>
<模块模块=org.iotashan.titouchimageviewID =androidPicture>< /模块>
< /滚动型>
不过,我不断收到此错误信息:
未捕获的错误:请求的模块未找到:org.iotashan.touchimageview
感谢您的输入阿图罗,但这不是问题。我终于想通了如何通过阅读指导使用在合金项目的模块。我最后的code是这样的:
<模块模块=org.iotashan.TiTouchImageViewID =androidPicture>< /模块>
I am currently developing a titanium app for android and iOs including an imageView which should be scrollable and scalable (via a slider). I already get this to work on iOs but on Android it is really hard to achieve the scrolling behaviour. I decided to use the TiTouchImageView module but the documentation only shows how to use it in a non-Alloy project. My current code looks like this:
if (Ti.Platform.osname == "android") {
var TiTouchImageView = require('org.iotashan.TiTouchImageView');
var androidImageView = TiTouchImageView.createView({
top: 0,
left: 0,
zoom: originalScaleValue,
maxZoom: originalScaleValue*2,
minZoom: originalScaleValue,
image: blob, });
$.androidInnerImageScrollView.add(androidImageView);
} else {
$.iosPicture.setImage(blob);
}
But is there a possibility to load this via the view.xml as an alloy component?
EDIT: I tried it using the module
tag in alloy:
<ScrollView id="androidInnerImageScrollView">
<Module module="org.iotashan.titouchimageview" id="androidPicture"></Module>
</ScrollView>
But I keep getting this error message:
Uncaught Error: Requested module not found: org.iotashan.touchimageview
Thanks for your input Arturo, but this was not the problem. I finally figured out how to use a module in an alloy project by reading the guide. My final code looks like this:
<Module module="org.iotashan.TiTouchImageView" id="androidPicture"></Module>
这篇关于在合金项目是一个TiTouchImageView工作? [更新]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!