我正在实现放大/缩小,我无法理解为什么scrollviewdidendzooming
委托函数没有被调用。
这是我的代码。我很困惑viewForZoomingInScrollView
函数被调用但scrollviewdidendzooming
没有。
- (void)viewDidLoad {
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height)];
_contentProgramsView = [[UIView alloc]initWithFrame:CGRectZero];
_contentProgramsView.tag = 9999;
[_contentProgramsView setUserInteractionEnabled:YES];
_scrollView.contentSize = CGSizeMake(5*9*self.view.frame.size.width,self.view.frame.size.height+400);
_scrollView.maximumZoomScale = 1.0f;
_scrollView.minimumZoomScale = 2.0f;
_scrollView.clipsToBounds = YES;
_scrollView setBouncesZoom:YES];
_scrollView.scrollEnabled = YES;
_scrollView.scrollsToTop = NO;
_scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_scrollView.delegate = self;
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return [_scrollView viewWithTag:9999];
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
//set the scrolling bounds
}
由于
答案 0 :(得分:0)
_scrollView.maximumZoomScale = 1.0f;
_scrollView.minimumZoomScale = 2.0f;
maximumZoomScale需要大于minimumZoomScale。 解决这个问题应该可行,但如果没有,请添加_scrollView.multipleTouchEnabled = YES;
我希望这会有所帮助。