I have a uiscrollview with contentsize 1280*1280 and 25 images of equal size loaded in it. When i scroll and meet an end, I want to know the identity of the image which is currently present at the screen centre. Given below is the code that i used to load the images into the scrollView. How can i figure it out?
for (i = 0; i < 5; i++) {
if(j == 5)
{
tx = tx+1;
x=x+256;
ty = ty+5;
y = y-1280;
}
for (j = 0; j < 5; j++) {
imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://stage.discoveritalia.it/tiles/%d/%d/%d.png",zoom,tx,ty]]]]];
frame = [imageView frame];
frame.origin.x = x;
frame.origin.y = y;
[imageView setFrame:frame];
[myScrollView addSubview:imageView];
ty = ty-1;
y = y+256;
[imageArray insertObject:imageView atIndex:i*5+j];
[imageView release];
}
}
If I could get the URL back, it would solve my problem right away. Is there a way to do it?