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

Adding PanGesture to Calendar

5 Answers 74 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kyle
Top achievements
Rank 1
Kyle asked on 18 Dec 2015, 09:41 PM

Hi,

 I'm trying to add a PanGesture to the calendar widget, as I want to implement a pull to refresh feature on the calendar itself.  So far, i've been unable to get any gestures that I add to the calendar to trigger.  Is there anything special I need to do to add gestures, and is it possible?   I can provide more information as needed, but I guess my first real question is can I do it, and if so how do I go about it.

 

I've been able to add gestures to tableviews and uiviews no problem up until this point.

 

Thank you

5 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 21 Dec 2015, 10:08 AM
Hi Kyle,

You can handle pan gestures in TKCalendar by adding a pan gesture recognizer to the active presenter. Consider the sample below:
TKCalendarMonthPresenter *presenter = (TKCalendarMonthPresenter*)self.calendarView.presenter;
[presenter addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]];

I hope this helps.

Regards,
Jack
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kyle
Top achievements
Rank 1
answered on 05 Jan 2016, 08:18 PM

Hi Jack.  

 This worked how I wanted, however it ran me into another issue I hadn't really thought about.  I now no longer have the ability to swipe left and swipe right to change months, since my new pan gesture is listening.  Is there a way to add my pan gesture on top of the existing functionality or will I have to listen in my pan gesture to fire off the month change events myself now?

 

Also i just realized I posted this in the wrong forums, I'm actually doing this in Xamarin.  However, I was able to follow your code no problem.

 

Thanks

0
Kyle
Top achievements
Rank 1
answered on 06 Jan 2016, 05:12 PM

Hi Jack,

 I was able to add my pan gesture successfully, but ran into a new problem, which I think is a bug with the Calendar.  So even if I remove all of my own code, I still observe this bug.  Basically when the calendar first loads, any Pan gesture on the calendar results in a month change, regardless of direction.  I believe only left or right Pan gestures should result in a month change.

 Every pan gesture after the first one, behaves correctly.  Up and Down pan gestures do nothing.  Left and Right pan gestures change months correctly.  This only occurs on the first pan gesture that occurs on the calendar.  

 This is causing me a problem because I was trying to add my own Pan Gesture for Up and Down to do some refreshing.  However, on the first Gesture, mine are ignored because the calendar changes months.  However, every other time I try to do my up and down gesture, it works perfectly.  Same with left and right.

 Is this indeed a bug and is it one that can be fixed?

 

To Replicate:

 Load calendar on screen.  Do a pan up or down gesture.  Watch calendar change months.  Now do another up or down pan gesture.  Watch calendar NOT change months.

 

Thank you for the help

 

 

0
Jack
Telerik team
answered on 07 Jan 2016, 03:41 PM
Hi Kyle,

Thank you for bringing our attention to this issue. Thanks to your description I managed to reproduce it and I logged the issue in our feedback portal. Our next release is in its final stage and I cannot guarantee that the issue will be addressed in this release. Use this link to track the issue status. I updated also your Telerik points.

Regards,
Jack
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kyle
Top achievements
Rank 1
answered on 07 Jan 2016, 03:45 PM

Hi again Jack,

Thanks for the quick response.  I understand about the next build, I've added my own workaround for the time being.  For anyone who is curious, I removed the existed PanGesture on the calendar that handled the month changes.  I then added my own swipe gestures for left and right, so that the pull down PanGesture I originally wanted to add worked correctly.

 

Thanks again!

Tags
Calendar
Asked by
Kyle
Top achievements
Rank 1
Answers by
Jack
Telerik team
Kyle
Top achievements
Rank 1
Share this question
or