This is a migrated thread and some comments may be shown as answers.

Gesture recognizer not fired

3 Answers 104 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Alex
Top achievements
Rank 1
Alex asked on 07 Oct 2014, 04:54 PM
Hi Telerik,

I have downloaded the latest version of iOS UI and I am using it with Swift. I am handling various gesture recognizers and the following is an example for the left swipe:
    let leftSwipeGesture = UISwipeGestureRecognizer(target: self, action: Selector("handleLeftSwipe:"))
    leftSwipeGesture.direction = UISwipeGestureRecognizerDirection.Left
       
It works fine. However, when I add a chart to the view controller, none of the gesture recognizers is triggering. Is this the expected behavior? If yes, are there workarounds? Here is how I add the chart to the view controller:
            TKChart chart = TKChart(frame: CGRectInset(self.view.bounds, 10, 10))
            self.view.addSubview(chart!)
            var items:NSMutableArray = []
            for x in 0...10 {
                var y = 100.0 * sin(M_PI * CDouble(x) + 100.0)
                items.addObject(TKChartDataPoint(x:CDouble(x + x * 3), y:y))
            }
            var series = TKChartSplineSeries(items:items)
            series.yAxis = TKChartNumericAxis(minimum:-100, andMaximum:100)
            var xAxis = TKChartNumericAxis(minimum:0, andMaximum:20)
            xAxis.majorTickInterval = 5
            series.xAxis = xAxis
            chart!.addSeries(series)

Thanks.

Alex

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 08 Oct 2014, 07:10 AM
Hi Alex,

Thank you for your interest in our controls.

Yes, this is the expected behavior. TKChart intercepts touch events in order to provide interactivity features like selection, pan and zoom. You can solve the issue by disabling chart interactivity. This can be done by setting the userInteractionEnabled property to false:

chart.userInteractionEnabled = false

Currently it is not possible to disable particular gestures in charts, this is logged as a feature request in our feedback portal and we will address the issue in a future release. Use the following link to track the issue status.

Do not hesitate to contact us if you have further questions.

Regards,
Jack
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alex
Top achievements
Rank 1
answered on 08 Oct 2014, 04:06 PM
Hi Jack,

Thank you. I have tested that I can receive the swipe and pinch events.

Alex
0
Jack
Telerik team
answered on 09 Oct 2014, 07:02 AM
Hello Alex,

Thank you for this update. I am glad to hear that this issue is solved now. Feel free to contact us if you have other questions.

Regards,
Jack
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
Alex
Top achievements
Rank 1
Answers by
Jack
Telerik team
Alex
Top achievements
Rank 1
Share this question
or