我在一张图片中有一个滚动视图。我只想放大并缩小滚动视图。如何通过捏合来应用放大和缩小?
答案 0 :(得分:1)
您必须将maximumZoomScale
的{{1}}和/或minimumZoomScale
属性设置为1.0以外的其他属性,以定义您希望用户能够放大/缩小的数量;)
答案 1 :(得分: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];
}