iphone - Get the identity of the image loaded at the centre of the screen currently? -
I contentsize equal size is a UIScrollView with loaded in the 1280 * 1280 25 images. When I scroll and meet one end, I want to know the identity of the image which is currently present in the screen center. I used the code below to load the images in ScrollView. How can I understand this?
(i = 0; i & LT; 5; i ++) {if (j == 5) {tx = tx + 1; X = X + 256; Ty = ty + 5; Y = y-1280; The} (j = 0; j & LT; 5; J ++) {imageView = [[UIImageView alloc] initWithImage: [UIImage imageWithData: [NSData dataWithContentsOfURL: [NSURL URLWithString: [NSString stringWithFormat: @ "http: // stage.discoveritalia. Ty] it / tiles /% d /% d /% d.png ", zoom, tx,]]]]; Frame = [image view frame]; Frame.origin.x = x; Frame.origin.y = y; [ImageView set frame: frame]; [MyScrollView addSubview: imageView]; Ty = ty-1; Y = y + 256; [ImageArray insertObject: imageView atIndex: I * 5 + j]; [See image release]; }}
I can get the URL back, this will solve my problem immediately. Is there any way to do this?
-
Calculate Sijeepiint
in the center of the screen (at orientation depends) -
x
andy
values 1280/5 tile ij < To determine / code> index, add
((1280/5) / 2)
that the center will overlap, withoutUIScrollView
offset
Comments
Post a Comment