如何检测特定的图像事件自来水

var gestures = require("ui/gestures"); 如何检测特定的图像事件自来水

for (var i = 0; i < images.length; i++) { 

imgArray[i] = new imageModule.Image();

imgArray[i].id = "img";

imgArray[i].width = w/6;

imgArray[i].height = h/7;

imgArray[i].src = images[i];

imgArray[i].stretch = "fill";

wrap_layout.addChild(imgArray[i]);

imgArray[i].on(gestures.GestureTypes.tap, function (args) {

console.log("tap"+"|"+i);

});

这是我的循环添加图像的阵列WrapLayout上nativescript是做工精良我的问题是我想实现双击手势为每个图像是工作,但没有图像的不特定指数的任何想法如何解决呢

回答:

var onTap = function (args) { 

console.log('tap');

};

images = raw_data.split("\n");

for (i = 0; i < images.length; i++) {

var m = re.exec(images[i]);

idArray[i] = m[0];

images[i] = images[i].replace(idArray[i], "");

imgArray[i] = new imageModule.Image();

imgArray[i].src = images[i];

imgArray[i].stretch = "fill";

stackArray[i] = new StackLayout();

imgArray[i].id = "img";

imgArray[i].width = sw;

imgArray[i].height = sh;

stackArray[i].id = "stack";

stackArray[i].width = sw;

stackArray[i].height = sh;

stackArray[i].num = i;

stackArray[i].addChild(imgArray[i]);

wrap_layout.addChild(stackArray[i]);

stackArray[i].on(buttonModule.Button.tapEvent, onTap, this);

}

这是为我工作

以上是 如何检测特定的图像事件自来水 的全部内容, 来源链接: utcz.com/qa/266432.html

回到顶部