Search code examples
ioschartsshinobi

How to decrease the long press duration to show the crosshair for Shinobi iOS SDK?


I would like to make it easier for the user to show/hide the crosshair on the chart. How do I decrease the long press duration?


Solution

  • Something like this should do the trick:

    #import "SChartCanvas.h"
    #import "SChartCanvasOverlay.h"
    
    @interface SChartCanvasOverlay (LongPress)
    - (void) changeLongPressDelay:(CFTimeInterval)time;
    @end
    
    @implementation SChartCanvasOverlay(LongPress)
    
    - (void) changeLongPressDelay:(CFTimeInterval)time
    {
        [longPressGesture setMinimumPressDuration: time];
    }
    
    @end
    

    The methods above should allow you to change the delay time on the long press like this:

    [chart.canvas.overlay changeLongPressDelay:0.2];