Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracking of currently displayed week/month section #3

Open
wants to merge 1 commit into
base: agendrix
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions FSCalendar/FSCalendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ IB_DESIGNABLE
*/
@property (strong, nonatomic) NSDate *currentPage;

/**
* The current section of calendar
*
* @desc In week mode, current section represents the current visible week; In month mode, it means current visible month.
*/
@property (readonly, nonatomic) NSInteger currentSection;

/**
* The locale of month and weekday symbols. Change it to display them in your own language.
*
Expand Down
5 changes: 5 additions & 0 deletions FSCalendar/FSCalendar.m
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSe

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
// Workaround to find the number of days in a week or month for Accessibility
if (_currentSection != indexPath.section) {
_currentSection = indexPath.section;
}

FSCalendarMonthPosition monthPosition = [self.calculator monthPositionForIndexPath:indexPath];

switch (self.placeholderType) {
Expand Down