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

Singlerow -- Single Row -- WeekView -- week view calendar setup #581

Closed
patchthecode opened this issue Oct 6, 2017 · 1 comment
Closed

Comments

@patchthecode
Copy link
Owner

patchthecode commented Oct 6, 2017

The correct setup for (most) Single row calendar is what you see below.

        let parameters = ConfigurationParameters(startDate: startDate,
                                                 endDate: endDate,
                                                 numberOfRows: 1,
                                                 generateInDates: .forFirstMonthOnly,
                                                 generateOutDates: .off,
                                                 hasStrictBoundaries: false)

Setting it up this way causes the inDates, to create an "offSet" which causes the other days/dates to be properly aligned.
Also, if you do not set it up this way, and you do NOT have generateOutDates set to off, you will see the outDates generated and you will begin to think that your calendar is showing dates twice. And then you'll create an issue telling me that there's a bug. And Then i'll have to create explanations like this :)

@patchthecode
Copy link
Owner Author

Configuring a single row calendar with a scrolling header

Question from user:

Hey there,
Thank you for a great library. But while customizing the calendar I face this problem. Hope you can help me out.

My Paramameter is:

ConfigurationParameters(startDate: startDate, endDate: endDate, 
     numberOfRows: 1, 
     calendar: Calendar.current,
     generateInDates: InDateCellGeneration.forFirstMonthOnly,
     generateOutDates: OutDateCellGeneration.off, 
     firstDayOfWeek: DaysOfWeek.monday, 
     hasStrictBoundaries: false)
Scrolling Direction: Horizontal

It works fine without the header, but when I add header, it creates the gap between months like this

screen shot 2017-10-17 at 10 04 12 pm

Answer

Yes, this is expected.

The reasoning is this.
A header is 7 cells long in a 6 row calendar. It cant be less than 7 cells because it will look weird.
The same thing applies to a 1 row calendar. When you added the header, it left the spaces where another month should start.

Fix:

If you want your "header" view to scroll with your cells (in a single row calendar), then do not implement a header externally. Instead do this:

  1. Keep your configureCalendar the same
  2. Design cell with a header on it.

Like this:

screen shot 2017-10-06 at 9 36 18 am

The cell can look like this, with a header on top. The label at the top will match the day of the cell.
If you use this approach, with the ConfigurationParameter code i posted above, then will this have your header "scroll with the cells"

Repository owner deleted a comment from shaunjacobsen Oct 19, 2017
Repository owner deleted a comment from shaunjacobsen Oct 19, 2017
This was referenced Nov 29, 2017
Repository owner deleted a comment from ggg-triple Apr 26, 2018
Repository owner deleted a comment from ggg-triple Apr 26, 2018
Repository owner deleted a comment from ggg-triple Apr 26, 2018
This was referenced Jun 12, 2018
Repository owner deleted a comment from Hamza123Imran Jun 13, 2018
Repository owner deleted a comment from Hamza123Imran Jun 13, 2018
Repository owner deleted a comment from Hamza123Imran Jun 13, 2018
This issue was closed.
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

No branches or pull requests

1 participant