1

我在一个图像中有一个滚动视图。我只想放大和缩小滚动视图。如何仅通过捏合来应用放大和缩小?

4

2 回答 2

1

您必须将您的maximumZoomScale和/或minimumZoomScale属性设置UIScrollView为 1.0 以外的其他值,以定义您希望用户能够放大/缩小多少;)

于 2011-01-20T16:00:37.040 回答
0

只需将文件http://www.4shared.com/dir/-PGqZEXR/zoominzoomout.html添加到您的项目中,并通过这些函数调用它。

im2是 UIVIEW,我将图像粘贴在上面,然后像这样传递它viewDidLoad

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

现在像这样附加这个功能,

- (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];
}
于 2011-01-21T06:46:57.370 回答