我已经实现了代表CPTPlotDataSource
和 CPTPlotSpaceDelegate
在我的 View Controller 中。我也设置了plotSpace.allowsUserInteraction = YES
和 self.hostView.allowPinchScaling = YES
.
然而,方法-(BOOL)plotSpace:(CPTPlotSpace *)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint
,-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point
,-(CGPoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint)proposedDisplacementVector
和-(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate
即使绘图是可缩放的,也不会调用。
我在代码中遗漏了什么?
谢谢!
最佳答案
我确实忘记设置我的委托(delegate):plotSpace.delegate = self;
关于objective-c - Core Plot 的 CPTPlotSpaceDelegate : Correct implementation of zooming and panning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11703165/