Update README and Example

This commit is contained in:
Wenchao Ding 2016-11-05 09:51:28 +08:00
parent 27bec3f80f
commit d52588f759
3 changed files with 16 additions and 6 deletions

View File

@ -34,6 +34,7 @@ typedef NS_ENUM(NSUInteger, FSCalendarMonthPosition);
- (NSIndexPath *)indexPathForDate:(NSDate *)date atMonthPosition:(FSCalendarMonthPosition)position;
- (NSIndexPath *)indexPathForDate:(NSDate *)date atMonthPosition:(FSCalendarMonthPosition)position scope:(FSCalendarScope)scope;
- (NSDate *)pageForSection:(NSInteger)section;
- (NSDate *)weekForSection:(NSInteger)section;
- (NSDate *)monthForSection:(NSInteger)section;
- (NSDate *)monthHeadForSection:(NSInteger)section;

View File

@ -193,6 +193,18 @@
[self.rowNumbers removeAllObjects];
}
- (NSDate *)pageForSection:(NSInteger)section
{
switch (self.calendar.scope) {
case FSCalendarScopeWeek:
return [self weekForSection:section];
case FSCalendarScopeMonth:
return [self monthForSection:section];
default:
break;
}
}
- (NSDate *)monthForSection:(NSInteger)section
{
NSNumber *key = @(section);
@ -282,9 +294,9 @@
- (FSCalendarMonthPosition)monthPositionForIndexPath:(NSIndexPath *)indexPath
{
NSDate *month = [self monthForSection:indexPath.section];
NSDate *page = [self pageForSection:indexPath.section];
NSDate *date = [self dateForIndexPath:indexPath];
NSComparisonResult comparison = [self.gregorian compareDate:date toDate:month toUnitGranularity:NSCalendarUnitMonth];
NSComparisonResult comparison = [self.gregorian compareDate:date toDate:page toUnitGranularity:NSCalendarUnitMonth];
switch (comparison) {
case NSOrderedAscending:
return FSCalendarMonthPositionPrevious;

View File

@ -27,7 +27,7 @@
![fscalendar-users](https://cloud.githubusercontent.com/assets/5186464/19956154/dd0f6bb4-a1c3-11e6-8fed-6aabbf999161.jpg)
## Fully DIV support
![1](https://cloud.githubusercontent.com/assets/5186464/20026517/bbba9b9a-a336-11e6-9bf6-a4f018c8489b.gif)
![1](https://cloud.githubusercontent.com/assets/5186464/20026796/9da4d2dc-a33c-11e6-8f21-54cd599cb939.gif)
## Working with AutoLayout and Orientation
@ -36,9 +36,6 @@
## Hide placeholder dates
![fscalendar-showsplaceholder](https://cloud.githubusercontent.com/assets/5186464/13727902/21a90042-e940-11e5-9b9f-392f38cf007d.gif)
## Scope gesture
![scopegesture](https://cloud.githubusercontent.com/assets/5186464/16909556/276fa8a8-4d06-11e6-8092-587952edb395.gif)
> FSCalendar doesn't change frame or the constraint by itself, see [Adjusts frame dynamicly](#adjusts_frame_dynamicly)
<br>