Is a TiTouchImageView working in an alloy project? [UPDATE]

送分小仙女□ 提交于 2019-12-20 06:12:57

问题


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

回答1:


i have been using this in my project like.

In xml

  <View id="windowView" module="org.iotashan.TiTouchImageView" platform="android" minZoom="0.1" maxZoom="9.5"></View>

In tss

"#windowView":{
top: 44,
height: Ti.UI.FILL,
width: Ti.UI.FILL,
backgroundColor: "trasparent"

}

In JS

$.windowView.image = "image path here"

And its working like a charm.




回答2:


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>



回答3:


Did you add the module reference to tiapp.xml? Any module should work on Alloy, you only need to take care of the SDK version.



来源:https://stackoverflow.com/questions/26425325/is-a-titouchimageview-working-in-an-alloy-project-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!