0

我必须UIScrollView从 0.28 scale(当前刻度)开始设置。我怎样才能正确地做到这一点?

现在缩放我正在使用这种方法:

#pragma mark - UIScrollViewDelegate Methods

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return imageView;
}

-(void)scrollViewDidZoom:(UIScrollView *)scrollView {
[self centerScrollViewContent];
}

-(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {

}

- (void)centerScrollViewContent {
CGSize boundsSize = self.scrollView.bounds.size;
CGRect contentsFrame = imageView.frame;

if (contentsFrame.size.width < boundsSize.width) {
    contentsFrame.origin.x = (boundsSize.width - contentsFrame.size.width) / 2.0f;
} else {
    contentsFrame.origin.x = 0.0f;
}

if (contentsFrame.size.height < boundsSize.height) {
    contentsFrame.origin.y = (boundsSize.height - contentsFrame.size.height) / 2.0f;
} else {
    contentsFrame.origin.y = 0.0f;
}

imageView.frame = contentsFrame;
}
4

1 回答 1

1

加载滚动视图内容后,您可以设置缩放比例:

self.scrollView.zoomScale = 0.28;
于 2012-12-08T18:53:03.237 回答