Pre loader

How can I add CursorModifier on long tap, after scrolling?


When I add CursorModifier programmatically on long tap I have to remove my finger from screen and press it again In order to CursorModifier become visible

Is it possible to do the following?

1) scroll chart horizontally

2) long tap on screen

3) add CursorModifier programmatically and show it immediately

4) move CursorModifier(finger is still touching the screen)

5) remove finger from screen and remove CursorModifier so I can scroll again

Thank you for reply in advance!

  • You must to post comments

Hi, there.

You can achieve this by subscribing to “gestureRecognizerShouldBegin” and “shouldReceive touch” delegate events and disable/enable your modifiers there.

  1. Create your Long Press Gesture recognizer and add it to your view

    private lazy var longPress: UILongPressGestureRecognizer = {
        let longPress = UILongPressGestureRecognizer()
        longPress.cancelsTouchesInView = false
        longPress.delegate = self
        return longPress
  2. Create your modifiers and add them to the Surface

    private let zoomPan = SCIZoomPanModifier()
    private let cursorModifier = SCICursorModifier()
  3. Subscribe to UIGestureRecognizerDelegate events

    override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        zoomPan.isEnabled = false
        cursorModifier.isEnabled = true
        return true
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
        cursorModifier.isEnabled = false
        zoomPan.isEnabled = true
        return true
  4. Long-press and move your finger. You should start to see cursor without removing the finger from the screen
    Let us know if it helps

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies