我使用iCarousel
实现了一个图库应用程序。现在我需要将捏合手势包含到zoom in or zoom out each image
。我添加了滚动视图并尝试了委托方法。但没有成功。
请帮帮我。
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)indexs reusingView:(UIView *)view
{
imgview = [[UIImageView alloc] init];
UIImage * img = [items objectAtIndex:indexs];
view = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320.0f,568)];
((UIImageView *)view).image = [UIImage imageNamed:@"page.png"];
imgView.image= img ;
imgView.contentMode = UIViewContentModeScaleAspectFit;
self.scrollView = [[UIScrollView alloc] init];
self.scrollView.backgroundColor = [UIColor redColor];
self.scrollView .frame = CGRectMake(18,10, 282, 568);
self.scrollView.delegate =self;
self.scrollView.contentSize = CGSizeMake(imgView.frame.size.width, imgView.frame.size.height);
self.scrollView.maximumZoomScale = MAXIMUM_SCALE;
self.scrollView.minimumZoomScale = MINIMUM_SCALE;
self.scrollView.clipsToBounds = NO;
[view addSubview:self.scrollView];
imgView.contentMode = UIViewContentModeScaleAspectFit;
[self.scrollView addSubview:imgView];
view.backgroundColor=[UIColor whiteColor];
view.layer.borderColor=[[UIColor lightGrayColor] CGColor];
view.layer.borderWidth=1;
view.layer.cornerRadius = 5;
view.layer.masksToBounds = YES;
return view;
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return imgView;
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
{
}
我尝试过这样的事情。
我也试过向imgView添加捏合手势。