我在一个图像中有滚动视图。我只想放大并放大滚动视图。我该如何应用缩放并仅通过紧缩来放大?

有帮助吗?

解决方案

只需添加文件 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];
}

其他提示

您必须设置 maximumZoomScale 和 /或 minimumZoomScale 您的属性 UIScrollView 除了1.0以外的其他功能,以定义您希望用户能够放大/输出多少;)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top