2012-01-27 79 views
1

我有一個帶有核心圖圖視圖的子視圖的滾動視圖。它不經常變焦。如果我們在滾動視圖後縮放滾動視圖,它將會變焦。帶有coreplot圖的子視圖的UIScrollView不經常縮放

每次委託方法 - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView將被調用,但調用委託方法的機會 - (void)scrollViewDidZoom:(UIScrollView *)scrollView非常少。

這種行爲的原因是什麼?

[consumptionGraphView_ addSubview:graphPlottedView_]; 
[graphPlottedView_ setContentScaleFactor:consumptionGraphView_.contentScaleFactor]; 

consumptionGraphView_.contentSize = consumptionGraphView_.frame.size; 
consumptionGraphView_.minimumZoomScale = 1.0; 
consumptionGraphView_.maximumZoomScale = 10.0; 
consumptionGraphView_.zoomScale = 0.1; 

回答

2

問題出在CorePlot的GraphHostingView中存在UIGestureRecognizers。

 for (UIGestureRecognizer * recognizer in hostingView.gestureRecognizers) { 
     [hostingView removeGestureRecognizer:recognizer]; 
    } 

此代碼將刪除UIGestureRecognizers,並且圖形縮放是完美的。

+1

在託管視圖中設置'allowPinchScaling' = NO以自動完成此操作。 – 2012-02-08 03:28:26

相關問題