2

I am trying to use JTcalendar library to build a custom calendar. In the current implementation , the scroll happens when the user swipes on the screen. I need two buttons left and right to support the scroll feature.

To do this , I have added two buttons in the menu bar for left and right scroll and tried to call the viewDidScroll() function on click of either. However this is not working.

Can anyone please point me in the right direction? I can share the current implementation if needed.

Chris Emerson
  • 13,041
  • 3
  • 44
  • 66
user2604897
  • 193
  • 1
  • 3
  • 13

2 Answers2

2

Using the above suggestions, this is how I was able to do this.

The contentView that I am using is from manager object as it is available in my MenuView Class. So this is now the shared contentView.

On this I have called loadpreviouspageWithAnimation and LoadNextPageWithAnimation.

Like So,

- (void) leftAction {
[_manager.contentView loadPreviousPageWithAnimation];

}

- (void) rightAction {
[_manager.contentView loadNextPageWithAnimation];
}

Where the _manager object is already available in the menuView and leftAction and RightAction are the target methods for the buttons.

Thanks!!

user2604897
  • 193
  • 1
  • 3
  • 13
1

You have define somewhere JTHorizontalCalendarView object like below line of code.

@property (weak, nonatomic) IBOutlet JTHorizontalCalendarView *calendarContentView;

So for next month

[_calendarContentView loadNextPage];

For previous month

[_calendarContentView loadPreviousPage];
Wolverine
  • 4,264
  • 1
  • 27
  • 49
  • Have tried using these methods but unable to get the scroll effect. I am using vertical calendar. Does that make a difference? – user2604897 Oct 13 '16 at 04:54
  • no, it will be same as above. try to check your "calendarContentView" is properly initialised. – Wolverine Oct 13 '16 at 04:55
  • Using these two methods in my case on debugging , I see that the control doesnt even enter the loadpreviouspage/ nextpage method! – user2604897 Oct 13 '16 at 05:06
  • My calendarContentView is an outlet of type JTVerticalcalendarView. the calendar loads up just fine and I am able to do other stuff like selecting dates, so i am guessing initialization is okay – user2604897 Oct 13 '16 at 05:08
  • Okay, on debugging i see that the contentView is set to nil. Guess I have to initialise it. Thanks – user2604897 Oct 13 '16 at 05:11
  • On initialising this property i get a blank calendar. Can you please guide how to initialise this property? – user2604897 Oct 13 '16 at 05:16
  • https://github.com/jonathantribouharet/JTCalendar Here it is explain in very much detail. Just try to follow step by step. You need to set the Outlet of your calenderContentView properly and set in calendarManager – Wolverine Oct 13 '16 at 05:35
  • HI. I am using his example project. hence all the outlets are set correctly. The thing that I am trying to achieve is buttons on the menuview which when clicked causes the view to scroll. Have tried the same. But I see the contentView gets initialised in viewDidLoad but in button action that I have sent here it is set to nil. – user2604897 Oct 13 '16 at 05:46
  • Can you post the code so i can understand more properly. On button action, try to use the content view which is created in viewdidload itself. – Wolverine Oct 13 '16 at 06:12