Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
NAUSHAD DARUWALLA
1,587 PointsUsing Projects From Github in your project
Hello all, I am trying to use this calendar from Github in my Xcode project but I do not know how to set it up and make it show in the simulator. How do I do this? Thanks you!
5 Answers
Holger Liesegang
50,595 PointsThe quick and dirty way would be using this link :)
...or
you start Xcode --> Source Control --> Check out... --> enter the following:
https://github.com/leverdeterre/CalendarIOS7.git
and then select the directory you want to save this project to et voilà you're done :)
NAUSHAD DARUWALLA
1,587 PointsOkay so I put the file into my project but how do I use the delegate and data source methods and how do I connect it to the mainStoryBoard?
Holger Liesegang
50,595 PointsBasically you have to add the <CALAgendaCollectionViewDelegate> after the class name of your @interface section and implement the three methods:
- (void)agendaCollectionView:(CALAgendaCollectionView *)agendaCollectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath selectedDate:(NSDate *)selectedDate;
- (BOOL)agendaCollectionView:(CALAgendaCollectionView *)agendaCollectionView canSelectDate:(NSDate *)selectedDate;
- (void)agendaCollectionView:(CALAgendaCollectionView *)agendaCollectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath startDate:(NSDate *)startDate endDate:(NSDate*)endDate;
You create the CalendarViewController with
CALAgendaViewController *agendaVc = [CALAgendaViewController new];
agendaVc.calendarScrollDirection = UICollectionViewScrollDirectionHorizontal;
agendaVc.agendaDelegate = self;
[agendaVc setFromDate:fromDate];
[agendaVc setToDate:toDate];
#Select cell style
agendaVc.dayStyle = CALDayCollectionViewCellDayUIStyleIOS7;
from inside your class.
I don't now, what you mean by "connect it to the mainStoryBoard?" ... e.g. you could create the CalendarViewController via IBAction after a button was pressed if that's what you mean...
Holger Liesegang
50,595 PointsI corrected this post, NAUSHAD DARUWALLA
NAUSHAD DARUWALLA
1,587 PointsOkay so when i try to implement these delegate methods, I don't know where they come from so how do I get them into my project so I can implement them?
Holger Liesegang
50,595 PointsNAUSHAD DARUWALLA Jérôme delivers a demo with CalendarIOS7 - you might want to take your time and have a look at it.