Getting touch events of a touch on imageview in a scrollview
I have a uiscrollview and i am showing some dynamically generated uiimageview over it. Now i want to do an action on touch at any of these images. I tried using touchbegn method but it is not being called. Please advice me what i am doing wrong.
   




   

    int numofRows = [arrMyPhotos count]/3;
        if([arrMyPhotos count]%3>0)
            numofRows++;
        scrlPhotoList.contentSize = CGSizeMake(320, numofRows*100);
        for(int i = 0;i<numofRows;i++) {
            x = 10;
            j = 0;
            while (j<3 && k<[arrMyPhotos count]) {
                NSString *pngFilePath = [[NSString stringWithFormat:@"%@/",docDir] stringByAppendingFormat:@"%@",[(NSDictionary*)[arrMyPhotos objectAtIndex:k] objectForKey:@"picName"]];
                NSLog(@"%@",pngFilePath);
                UIImage *img = [UIImage imageWithContentsOfFile:pngFilePath];
                if(img!=nil) {
                    UIImageView *imgVw = [[UIImageView alloc] init];
                    imgVw.image = [self imageByScalingAndCroppingForSize:CGRectMake(0, 0, 95, 95) image:img];
                    imgVw.tag = k;
                    imgVw.frame = CGRectMake(x, y, 95, 95);
                    imgVw.userInteractionEnabled = TRUE;
                    imgVw.multipleTouchEnabled = TRUE;
                    
                    [scrlPhotoList addSubview:imgVw];
                    //k++;
                    x = x+105;
                    j++;
                }
                k++;
            }
            y = y+105;
        }
        [self.view addSubview:scrlPhotoList];
Getting touch events of a touch on imageview in a scrollview
===

I have a uiscrollview and i am showing some dynamically generated uiimageview over it. Now i want to do an action on touch at any of these images. I tried using touchbegn method but it is not being called. Please advice me what i am doing wrong.
   




   

    int numofRows = [arrMyPhotos count]/3;
        if([arrMyPhotos count]%3>0)
            numofRows++;
        scrlPhotoList.contentSize = CGSizeMake(320, numofRows*100);
        for(int i = 0;i<numofRows;i++) {
            x = 10;
            j = 0;
            while (j<3 && k<[arrMyPhotos count]) {
                NSString *pngFilePath = [[NSString stringWithFormat:@"%@/",docDir] stringByAppendingFormat:@"%@",[(NSDictionary*)[arrMyPhotos objectAtIndex:k] objectForKey:@"picName"]];
                NSLog(@"%@",pngFilePath);
                UIImage *img = [UIImage imageWithContentsOfFile:pngFilePath];
                if(img!=nil) {
                    UIImageView *imgVw = [[UIImageView alloc] init];
                    imgVw.image = [self imageByScalingAndCroppingForSize:CGRectMake(0, 0, 95, 95) image:img];
                    imgVw.tag = k;
                    imgVw.frame = CGRectMake(x, y, 95, 95);
                    imgVw.userInteractionEnabled = TRUE;
                    imgVw.multipleTouchEnabled = TRUE;
                    
                    [scrlPhotoList addSubview:imgVw];
                    //k++;
                    x = x+105;
                    j++;
                }
                k++;
            }
            y = y+105;
        }
        [self.view addSubview:scrlPhotoList];