Iphone 我想在ScrollView中放大和缩小。如何';有可能吗?

Iphone 我想在ScrollView中放大和缩小。如何';有可能吗?,iphone,uiscrollview,zooming,uiscrollviewdelegate,pinch,Iphone,Uiscrollview,Zooming,Uiscrollviewdelegate,Pinch,我有一个在一个图像滚动视图。我只想放大和缩小滚动视图。如何仅通过收缩就应用放大和缩小?您必须将UIScrollView的maximumZoomScale和/或minimumZoomScale属性设置为1.0以外的值,以定义您希望用户能够放大/缩小的程度;) 您必须将UIScrollView的maximumZoomScale和/或minimumZoomScale属性设置为1.0以外的值,以定义您希望用户能够放大/缩小的程度;) 只需将文件添加到项目中,并通过这些函数调用它即可 这里的im2是UIV

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

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

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

只需将文件添加到项目中,并通过这些函数调用它即可

这里的
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];
}
现在像这样附加这个函数

- (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];
}
-(无效)加载花卉视图:(UIView*)背景
{
NSString*创建按钮=nil;
//将花添加到屏幕上的随机点
对于(int i=0;i<1;i++)
{
MagPicAppDelegate*appdelegate=(MagPicAppDelegate*)[[UIApplication sharedApplication]委托];
NSString*whichFlower=appdelegate.imageName;
UIImage*stemp=[UIImage ImageName:@“approve.png”];
DragView*dragger=[[DragView alloc]initWithImage:stemp];
dragger.userInteractionEnabled=是;
dragger.center=CGPointMake(160.0f,140.0f);
[im2添加子视图:拖动器];
[牵引释放];
}
}
[self.view addSubview:im2];
[im2释放];
}
只需将文件添加到项目中并通过这些函数调用即可

这里的
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];
}
现在像这样附加这个函数

- (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];
}
-(无效)加载花卉视图:(UIView*)背景
{
NSString*创建按钮=nil;
//将花添加到屏幕上的随机点
对于(int i=0;i<1;i++)
{
MagPicAppDelegate*appdelegate=(MagPicAppDelegate*)[[UIApplication sharedApplication]委托];
NSString*whichFlower=appdelegate.imageName;
UIImage*stemp=[UIImage ImageName:@“approve.png”];
DragView*dragger=[[DragView alloc]initWithImage:stemp];
dragger.userInteractionEnabled=是;
dragger.center=CGPointMake(160.0f,140.0f);
[im2添加子视图:拖动器];
[牵引释放];
}
}
[self.view addSubview:im2];
[im2释放];
}