Hi @patchthecode
I am trying to use JTAppleCalendar with a weekly view (one row only) as this is what I had in my app. Having a month view makes sense for iPhone 6 and 6+ but it's too big for iPhone 4 and iPhone 5.
My problem is that you can have a week which starts with "29, 30, 31, 1, 2, 3, 4" but if you scroll left you will get "5, 6, 7, 8, 9, 10, 11".
Any idea how can I get rid of those extra cells?
I had:
func configureVisibility(cellState: CellState) {
if cellState.dateBelongsTo == .ThisMonth {
self.hidden = false
} else {
self.hidden = true
}
}
In my CellCode but this makes the row to be empty so users have to scroll through empty space which is just a bad UX.
Any pointers?
This is an awesome library btw.
Thanks.
You would be talking about this -> https://github.com/patchthecode/JTAppleCalendar/issues/56
This is currently being worked on and is the final upgrade for this calendar.
It will allow a user to enable/disable the in-date and out-date cells.
Currently coding is 45% complete on this
Btw, just to clarify,
When you say "get rid" of the cells, do you mean to make them hidden? or do you mean to make them not generated?
If they are hidden, there will be some space there which indicates that they are there, but are just invisible,
If however, they are not generated, then there will be no space there. Following cells will be generated right next to each other with no space.
HI @patchthecode
I meant - not generated.
I have read https://github.com/patchthecode/JTAppleCalendar/issues/56 but it's still quite confusing how I would like to achieve this.
Also any dates for the release? :)
yesterday it was 45% completed. Today Its 85% completed.
I can't predict a release though. I will have to test it.
In terms of how you will be able to achieve this, it will be simple.
I will give you an option to turn inDates eitheron or off
and
I will give you an option to turn outDates eitheron or tillGrid or tillRow or off

An outDate of tillRow will stop the outdate generation at date 5
An outDate of tillGrid will stop the outdate generation at date 12
An outDate of off will cause no outdates to be generated. It will stop at 29
The different between the 2 outdates are that tillGrid will always generate a 6x7 grid of dates.
tillRow however will only generate outdates to fill the row. This means that if you use tillRow, some of your months will have 4 row, or 5 rows, or 6 rows, depending on how many days are in the month i.e your number of rows per month can change. With tillGrid you will always have a fixed 6 rows per month (like it is currently done now in version 5.0.1)
the function I will modify is this one
func configureCalendar(calendar: JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar, generateInDates: Bool, generateOutDates: OutDateCellGeneration)
So all you have to do is simply tell that function if you want indates/outdates generated or not. Thats it.
That's brilliant - is the branch DynamicGeneration? I don't mind taking a look too. Thanks for all hard work!
Edited my explanation above to include off for outdates
And yes, its in the DynamicGeneration branch. Currently, the vertical calendar is done. Im just finishing up the code for the horizontal one. No other functions work, just the displaying of the calendar (for vertical mode) works for now. I should be finished with the Horizontal calendar by today hopefully.
You will be able to see the vertical calendar in action after i push my changes some time tonight. Currently my changes are still on my local machine.
Hi @patchthecode , any update on pushing the changes? Thanks, Damian
yes.
pushing in 2 mins :)
Im just code reviewing
Awesome stuff! @patchthecode
Keep in mind. Other functionality might be broken ok. Its just the configure function that works, and displays the dates for now.
It has been pushed to branch.
No worries, I will give it a try and thanks for letting me know - looking forward to stable version too.
Hi @patchthecode
It looks good apart this bit:
func configureCalendar(calendar: JTAppleCalendarView) -> (
startDate: NSDate,
endDate: NSDate,
numberOfRows: Int,
calendar: NSCalendar,
generateInDates: Bool,
generateOutDates: OutDateCellGeneration) {
let firstDate = formatter.dateFromString("2015 01 01")
let secondDate = NSDate()
let aCalendar = NSCalendar.currentCalendar()
return (startDate: firstDate!,
endDate: secondDate,
numberOfRows: numberOfRows,
calendar: aCalendar,
generateInDates: false,
generateOutDates: OutDateCellGeneration.tillEndOfRow)
}
If OutDateCellGeneration is set to off then when you scroll to next month - some dates are missing on Monday, Tuesday, Wednesday? 馃懐
Looking forward to release as my app is quite dependant on this library. Thanks for all hard work!
Also (attaching screenshots), when OutDateCellGeneration is set to tillEndOfRow:

We scroll right and see:

Yes, I'm working on that last part. Vertical works well, but I found this bug yesterday for horizontal. Working on it.
HI @patchthecode - Any update? Thanks for all your hard work again :)
Hmm. Ok hey, maybe it might be best if you try another calendar in the mean time if this will impact your work.
I can only work on this project after my own work at the end of the day :)
Because this is my blow-off-steam-from-work project.
I'm still coding that last part.
Currently vertical calendar works in all modes with the new code.
Horizontal calendar works in all modes except the one you want -> which is no in-Dates and no out-dates.
The reason this one is a little more complicated is it breaks the concept of sections and months. This is because since there are no buffer days (in/out days) it will not be a predefined grid. Therefore calculating where the cells will be is a little difficult.
I also have to make it work for all 1, 2, 3, and 6 row modes. Every time I think i cracked it, I see a bug in another mode. Will try fixing it for about 2-3 more days before asking for help.
Ok, i think I might have made a break through.
The code is still messy, but I think it works. Will push to master branch in about 3 hrs
The code has been pushed.
@mazurio hey, we're thinking of making that branch converted to swift 3. My work is moving over to that swift version.
Hi @patchthecode
Thanks for updates - been busy for last few days so couldn't reply.
I'm fine with Swift 3.
How are the updates going?
Check it out.
I think its working. The code has already been committed. Currently, i'm running more tests for bugs. I haven't found any yet as of yesterday. One update needs to be done (about 30 mins code time). For the horizontal calendar, I need to now make the height adjustable.
Is it the one for Swift3 or DynamicGeneration?
DynamicGeneration
Great! Thanks - I will try it in the evening.
Most helpful comment
yesterday it was 45% completed. Today Its 85% completed.
I can't predict a release though. I will have to test it.
In terms of how you will be able to achieve this, it will be simple.
I will give you an option to turn inDates either
onoroffand
I will give you an option to turn outDates either
onortillGridortillRoworoffAn outDate of
tillRowwill stop the outdate generation at date5An outDate of
tillGridwill stop the outdate generation at date12An outDate of
offwill cause no outdates to be generated. It will stop at29The different between the 2 outdates are that
tillGridwill always generate a 6x7 grid of dates.tillRowhowever will only generate outdates to fill the row. This means that if you usetillRow, some of your months will have 4 row, or 5 rows, or 6 rows, depending on how many days are in the month i.e your number of rows per month can change. WithtillGridyou will always have a fixed 6 rows per month (like it is currently done now in version 5.0.1)the function I will modify is this one
So all you have to do is simply tell that function if you want indates/outdates generated or not. Thats it.