I have a UIScrollviewc UIImageViewinside where I look at an image on another.
I used the Apple TapToZoom sample code to implement scaling, but whenever I zoom in, the scrolling starts from the beginning, not from the active image.
Here is a snippet of my code:
Initialize and fill out the image:
table = [[NSMutableArray alloc] initWithCapacity:7];
for(int count = 1; count <= 7; count++)
{
NSString *fileName = [NSString stringWithFormat:@"image%d.jpg", count];
UIImage *image = [UIImage imageNamed:fileName];
[table addObject:image];
if (image == nil) {
break;
}
imageView = [[UIImageView alloc] initWithImage:image];
imageView.userInteractionEnabled = YES;
imageView.multipleTouchEnabled = YES;
Implement highlight gesture:
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
The method handleDoubleTapapproaches the center imageViewand brings a scroll to the top of the swap page.
I searched a lot about this, but could not find a way to increase the actual displayed image.
Thanks in advance:)
Ahmed source
share