views:

31

answers:

2

Hi,

I have a UIView (mainview), including 50 UIImageViews (image1 .. 50))

(all are set to clickable (UIVIEW and also UIImageViews)

Now to test if one of my images is touched I do in 'touchesbegan':

touch = [[event allTouches] anyObject];
if ([touch view] == image1) { NSLog (@"image1 clicked"); }

But when i test on if my "mainview" (where all images are in) came clicked with:

if ([touch view] == mainview) { NSLog (@"mainview clicked");}

I dont get an confirmation!??

In Short: When mainview alone is clickable i get an OK if clicked But when I activated all images (in the mainview) to be clickable .. I just can check if they are clicked but not anymore my mainview.

view
   mainview
     image1
     image2
     image3
     ..image50

Any ideas?? Thx Chris

A: 

is the touch occurring on one of the image views or on the main view directly?

gga80
on one of the imageviews! Thats the point. But rather checking if each of this 50 Images is touched (with a loop) a simple check if the parent view is touched would be much easier.
christian Muller
still looking for help! right now i try with:for( UITouch *touch in [touches allObjects]) { if( [touch view] == mainview ) { NSLog (@"jojojo"); } }but still i cant find that my "mainview' is touched.
christian Muller
A: 

That’s because the buttons take the touch. When a touch occurs, it goes up the responder chain until something responds to it—in this case, your buttons. Check out the touch section of the Event Handling Guide for iPhone OS.

Jeff Kelley
thx.. i looked in it.. also i dont get the solution .. short sample would be really nice.
christian Muller