Skip to content

Commit

Permalink
Merge pull request #8 from nuthinking/master
Browse files Browse the repository at this point in the history
Fixed first empty row bug in vertical layout.
Thanks for this work and sorry for this late response (WWDC time @san Francisco)
  • Loading branch information
leverdeterre committed Jun 2, 2014
2 parents 0be887b + d63697c commit 56ea861
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CalendarIOS7/CalendarIOS7/CALViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ - (void)showMyCalendarWithScrollDirection:(UICollectionViewScrollDirection)direc
self.agendaVc.calendarScrollDirection = direction;
self.agendaVc.agendaDelegate = self;
NSDateComponents *components = [NSDateComponents new];
components.month = 1;
components.month = 5;
components.day = 1;
components.year = 2014;
NSDate *fromDate = [[NSDate gregorianCalendar] dateFromComponents:components];
components.month = 3;
components.month = 12;
components.day = 1;
NSDate *toDate = [[NSDate gregorianCalendar] dateFromComponents:components];
[self.agendaVc setFromDate:fromDate];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,12 @@ - (CGRect)frameForItemAtIndexPath:(NSIndexPath *)indexPath previousRect:(CGRect)
else {
CGRect theoricalRect = previousRect;
theoricalRect.origin.x = theoricalRect.origin.x + self.minimumInteritemSpacing + self.itemSize.width;
if ((theoricalRect.origin.x + self.itemSize.width) > self.collectionView.frame.size.width) {
theoricalRect.origin.x = 0.0f;
theoricalRect.origin.y = theoricalRect.origin.y + self.minimumLineSpacing + self.itemSize.height;
}
if ((indexPath.section - previousIndexPath.section) > 0) {
theoricalRect.origin.y = theoricalRect.origin.y + self.itemSize.height + self.headerReferenceSize.height + self.minimumLineSpacing;
theoricalRect.origin.x = 0.0f;
}else if ((theoricalRect.origin.x + self.itemSize.width) > self.collectionView.frame.size.width) {
theoricalRect.origin.x = 0.0f;
theoricalRect.origin.y = theoricalRect.origin.y + self.minimumLineSpacing + self.itemSize.height;
}
return theoricalRect;
}
Expand Down

0 comments on commit 56ea861

Please sign in to comment.