user866807
user866807

Reputation: 43

Core Plot momentum scrolling

Is there any way I can make the Core Plot scrolling behave like momentum scrolling in UIScrollView? I have made a CPTGraphHostingView and added it to a UIViewController.view as a subview.

Would someone be kind enough to provide a direction or code to guide me through?

Upvotes: 2

Views: 705

Answers (3)

Pang
Pang

Reputation: 10127

Since Release 1.3, in CPTXYPlotSpace, there is a flag called allowsMomentum:

If YES, plot space scrolling slows down gradually rather than stopping abruptly. Defaults to NO.

So, you can do something like this:

CPTGraph* graph = /* Your graph object */
CPTXYPlotSpace* plotSpace = (CPTXYPlotSpace*)graph.defaultPlotSpace;
plotSpace.allowsMomentum = YES;

Upvotes: 6

alexkent
alexkent

Reputation: 1586

There is a WWDC 2012 presentation 'Enhancing User Experience with Scroll Views' which explains how to invisibly overlay a UIScrollView on a OpenGL view then link the scolloffset to get the momentum scrolling behaviour in OpenGL. I expect a similar approach could be used for your problem.

https://developer.apple.com/videos/wwdc/2012/?id=223

Upvotes: 3

Eric Skroch
Eric Skroch

Reputation: 27381

There's nothing like that built in. You might be able to achieve a similar effect using a plot space delegate.

Upvotes: 0

Related Questions