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 option for sticky month labels in calendar with week scope #189

Closed
wants to merge 2 commits into from

Conversation

benrudhart
Copy link

If calendar is used in a week scope:
The month labels "change" every time you change the week. This can be confusing cause month labels most often will change to the same month (e.g. from January 2016 to January 2016).
When using this option the month label only changes when the month of the date in the current week view changes.

@benrudhart
Copy link
Author

Why did you close this PR? Think this could be really helpful bc. it removes the redundant changes of the month labels in .Week scope when the month didn't really change...

@WenchaoD
Copy link
Owner

When I test it in "FSCalendarScopeExample", the month label stay in the middle of the transition (but the scrolling animation has already stopped), it looks wierd I think.
screen shot 2016-02-25 at 15 19 15

@benrudhart
Copy link
Author

That should only be the case when the week contains parts of two months (here January and February). There should only be one label in case the week contains only days that belong to one month (for instance Februar, if you keep on scrolling to the right to end up in the week starting from February 6th.)
This way the month labels show the same as the days of the week show: parts of two months.

NSDate *date = nil;

if (_calendar.scope == FSCalendarScopeWeek && _calendar.useStickyMonthLabelsInWeekScope) {
date = [_calendar dateByAddingMonths:indexPath.item-2 toDate:firstPage];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date = [_calendar dateByAddingMonths:indexPath.item-1 toDate:firstPage];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants