Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to extend the gesture handler? #2419

Closed
akeskiner opened this issue May 8, 2017 · 3 comments
Closed

Is it possible to extend the gesture handler? #2419

akeskiner opened this issue May 8, 2017 · 3 comments

Comments

@akeskiner
Copy link

Hi,
I want to add additional behaviour to built in gesture handlers. Is that possible? For example when there is a UIPanGesture, I want to zoom out while I'm scrolling through the chart.

lineChartView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handleGesture)))

If I add a gesture recognizer like this, it conflicts with scrolling behaviour.
Thanks.

@aelam
Copy link
Contributor

aelam commented May 8, 2017 via email

@akeskiner
Copy link
Author

I see, but I still have the problem of not having both recognizers (chart's recognizer and mine).

The code I have is:

let additionalView = UIView(frame: self.lineChartView.frame)
additionalView.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handleGesture)))

self.view.addSubview(additionalView)

@liuxuan30
Copy link
Member

liuxuan30 commented May 9, 2017

The gesture handler is fileprivate, so you can provide your own for sure. Just rebind to the handler in your sub class. It's intended to be private a long time ago, so you can use your own, or you can modify the source code as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants