如何滚动到x,y,刻度不是1.0?
我认为我所要做的就是按比例将它复用。如果我在zoomScale为1时滚动到100,100,当zoomScale为.50时,是否应该转换为50,50?
答案 0 :(得分:0)
不确定setContentOffset但如果你这样做就不需要转换:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return self.rootView;
}
- (void)zoomToPointInRootView:(CGPoint)center atScale:(float)scale {
CGRect zoomRect;
zoomRect.size.height = [scrollView frame].size.height / scale;
zoomRect.size.width = [scrollView frame].size.width / scale;
zoomRect.origin.x = center.x - (zoomRect.size.width / 2.0);
zoomRect.origin.y = center.y - (zoomRect.size.height / 2.0);
[scrollView zoomToRect:zoomRect animated:NO];
}