views:

18

answers:

1

I would like to know which element was under the finger, when the touch event was called. Got this event-method:

- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {}

I know how to get the object with custom events: for example:

-(void)onThumbnailClicked:(NSNotification *)notification
{
    //Image-Class has been instantiated a certain times and I get the touched Image through the notification object...
    Image* myObject = [notification object]; 
}

To illustrate my issue: I instantiate a set of Image-Classes through

Image *myImageView = [[Image alloc] initWithImage:myImage];

in this Image-Class I have touches-began / touches-ended methods. Know I try to figure out which image was under my finger when I touched the screen, to perform a certain Action.

A: 

Your question doesn't really make sense. The "element" that "fired" your touch event was your finger. The first element to respond to the touch event is either 1) the one that has the IBAction that was triggered (in which case the sender parameter of the method is the element that fired the action), or 2) the object in which you've implemented the touches(Began|Moved|Ended): method.

Dave DeLong
I edited my question for giving more sense to it. Generally I would like to find out which image was under my finger when -touchEnded was called and how I could implement that
algro