2012-10-01 25 views
0

我有一個UIScrollView,並啓用滾動。它使用委託方法正常工作。UnZoom UIScrollView

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

但是我面臨的問題是,我需要在旋轉iPad時縮小UIScrollView。 我必須在這個代碼功能是什麼

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    { 
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || 
     interfaceOrientation == UIInterfaceOrientationLandscapeRight){ 

    } 
    if(interfaceOrientation == UIInterfaceOrientationPortrait || 
     interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) 
    { 

    } 
} 

回答

1

您可以使用此方法:- (void)setZoomScale:(float)scale animated:(BOOL)animated和規模設置爲您滾動型的最低縮放比例,當你已經創建了滾動你可能已經配置。

實施例:

[MyScrollview setZoomScale:minimuzoomscale動畫:YES];

將上線放在shouldAutorotate中。

+0

我的視圖正在縮放。但我需要在我旋轉時取消縮放。任何想法 – vishnu

+0

假設在旋轉scrollview的縮放比例之前是3.0,所以在旋轉之後它應該被重置爲最小值或1.0右邊? – Iducool

2

只是把

[YourScrollView setMaximumZoomScale:1]; 
[YourScrollView setMinimumZoomScale:1]; 

在你的方向。