Hi ppl! i am doing a simple math quiz. For one of the question, i would like the user to drag and drop an image to a specific area where it will auto lock it. Just like this example. How do i do it on titanium for ios?
This is the code i am currently making use of for drag and drop:
var win = Ti.UI.currentWindow; var imageView = Titanium.UI.createImageView({ image:'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png', width:261, height:178, top:20 }), olt = Titanium.UI.create3DMatrix(), curX, curY; imageView.addEventListener('touchstart',function(e){ curX = e.x; curY = e.y; }); imageView.addEventListener('touchmove',function(e){ var deltaX = e.x - curX, deltaY = e.y -curY; olt = olt.translate(deltaX,deltaY,0); imageView.animate({transform: olt, duration: 100}); }); win.add(imageView);