2012-07-04 81 views

回答

0

根據縮放後視圖的大小切換滾動視圖的來源。

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

    CGFloat vPadding; 
    CGFloat hPadding; 
    if ((480-view.frame.size.height)/2 > 0) { 
      vPadding=(480-view.frame.size.height)/2; 
    } 
    else{ 
      vPadding=0; 
    } 
    if ((320-view.frame.size.width)/2 > 0) { 
      hPadding=(320-view.frame.size.width)/2; 
    } 
    else{ 
      hPadding=0; 
    } 
    yourView.frame = CGRectMake(hPadding, vPadding, view.frame.size.width, view.frame.size.height); 

} 

或相應地更改滾動視圖中心。

相關問題