Q:

Return position in NSArray from ScrollView

I'm trying to create a scrollview with an array of clickable UIImageView's. My goal is that when an ImageView is clicked, it returns which position in the array it occupies. The problem is that i don't know how to "catch" the position's number. How do I do that? 
So far I have:
- (IBAction)respondToTapGesture:(UITapGestureRecognizer *)recognizer {

    NSLog(@"%@",)//here is where i want to return the element's position.
}

-(void) preenchemenu {

    [menu setContentSize:CGSizeMake(400, 91)];
    int x=0;
    imagensmenu=[NSArray arrayWithObjects:[UIImage imageNamed:@"teste2.tiff"],[UIImage    imageNamed:@"teste2.tiff"], nil];

    for (int i = 0; i <3; i++) {

        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(x,0 , 90, 91)];
        x=x+90;
        imageView.image = [imagensmenu objectAtIndex:i];
        imageView.tag = 1000+ i;
        imageView.userInteractionEnabled = YES;
        imageView.multipleTouchEnabled = YES;
        UITapGestureRecognizer *tapRecognizermenu = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(respondToTapGesture:)];
        tapRecognizermenu.numberOfTapsRequired = 1;

        [imageView addGestureRecognizer:tapRecognizermenu];
        [menu addSubview:imageView];
    }
}

A:

You can create an array to hold you imageViews and then find the position of your imageView in this array when it is tapped.
Add a property for this
@property (nonatomic, strong) NSMutableArray *imageViews;

initialise it in init
- (id)init...
{
  self = [super init...
  if (self) {
    _imageViews = [NSMutableArray array];
  }
  return self;
}

Then amend your current method slightly to also add the imageViews to this array as well as a subview of the menu
[self.imageViews addObject:imageView];
[menu addSubview:imageView];

Then in your gesture recognizer call back you can do
- (void)respondToTapGesture:(id)sender;
{
  UIView *view = [sender view];
  NSLog(@"%d", [self.imageViews indexOfObject:view]);
}

