aspose file tools*
The moose likes iOS and the fly likes Add Action listener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Add Action listener " Watch "Add Action listener " New topic
Author

Add Action listener

asif Bashir
Greenhorn

Joined: May 14, 2013
Posts: 1
I am creating an App for iPhone using JavaScript. I have an array of images, let say img[] ,and a place all these images on screen i want to add action listener to each image. Each image has to perform different functionality. I am using this method

for(var i=0;i<img.length)
{
img[i].addactionlistner('click',function(e){
//Print the index of image clicked
});


}
This method add action listener to images.Please tell me that this method is right or not. If yes then how can i identify that which image is clicked(it should tell me the index).
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

You are creating a native iOS app using JavaScript?

Any way, is the method you are using is correct or not? Try it!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Add Action listener