Question

I have a scroll view within one image. I just want to zoom in and zoom out the scroll view. How do I apply zoom in and and zoom out just by doing the pinch?

Was it helpful?

Solution

Just add the file http://www.4shared.com/dir/-PGqZEXR/zoominzoomout.html to your project and call it through these functions.

Here im2 is UIVIEW, and I paste the image on it then passing this through viewDidLoad like this,

- (void)viewDidLoad {
    [self loadFlowersInView:im2];
    [self.view addSubview:im2];
}

Now attach this function like this,

- (void) loadFlowersInView: (UIView *) backdrop
{
    NSString *create_button = nil;
    // Add the flowers to random points on the screen
    for (int i = 0; i < 1; i++)
    {
            MagPicAppDelegate *appdelegate = (MagPicAppDelegate *)[[UIApplication sharedApplication] delegate];

            NSString *whichFlower = appdelegate.imageName;
            UIImage *stemp = [UIImage imageNamed:@"approve.png"];
            DragView *dragger = [[DragView alloc] initWithImage:stemp];
            dragger.userInteractionEnabled = YES;
            dragger.center = CGPointMake(160.0f, 140.0f);
            [im2 addSubview:dragger];
            [dragger release];
        }
    }
    [self.view  addSubview:im2];
    [im2 release];
}

OTHER TIPS

You have to set the maximumZoomScale and / or minimumZoomScale properties of your UIScrollView to something else than 1.0 to define how much you want the user to be able to zoom in/out ;)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top