2011-03-07 104 views

回答

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]; 
} 
相關問題