Adding PanGesture to Calendar

6 posts, 0 answers
  1. Kyle
    Kyle avatar
    30 posts
    Member since:
    Dec 2014

    Posted 18 Dec 2015 Link to this post

    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

  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Dec 2015 Link to this post

    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
  3. DevCraft banner
  4. Kyle
    Kyle avatar
    30 posts
    Member since:
    Dec 2014

    Posted 05 Jan in reply to Jack Link to this post

    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

  5. Kyle
    Kyle avatar
    30 posts
    Member since:
    Dec 2014

    Posted 06 Jan in reply to Kyle Link to this post

    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

     

     

  6. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 07 Jan Link to this post

    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
  7. Kyle
    Kyle avatar
    30 posts
    Member since:
    Dec 2014

    Posted 07 Jan in reply to Jack Link to this post

    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!

Back to Top
DevCraft banner