-
Notifications
You must be signed in to change notification settings - Fork 813
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
Option to avoid toggle button behaviour on multiple selection #98
Comments
[EDITED] You have And, If the date that you are trying to select is already selected, you want it to remain selected when you call this function?
what are your thoughts on this? |
Hi I have made an upgrade to the JTAppleCalendar library. If you are using this library with cocoapods, then can you follow these instructions on question 8 to test it? |
Hi! I tested and it works, the selected days remain selected! But unfortunately this just fix a part of my problem. I'm gonna try to explain myself the best I can, maybe you can help me find and approach :] I need to make a leaves calendar, so I need to mark in te calendar (with bars, as you can see on the example) a range of dates, that are the leave days of some other people. Sometimes you have 2 or more people on leaves at the same time, so I need to show that with the bars. This is an example of what i want to achieve The biggest problem I think is on dates after October 7th, because is a date selected just once, but the red bar started on the third position and it needs to continue in that position. Maybe I just need to store in the calendar what cells are selected and what bars are on/off and notify the cell what bars have to show, and keep all the logic in the calendar. Sorry for the troubles! Thanks a lot! |
OK, I am not sure I fully understand what you are trying to achieve. |
How do I know to show the bar in the third position? in other words how do i know that bar is a continuation of the previous one? On day 5 you can notify the cell that he needs to show 3 bars, because the date is contained 3 times on my array of dates... and on day 6 I notify the cell he need to show 2, but in what order? The only way i'm figure it out is get the all the cells that represents the dates of the range and set the bar to ON I make this peace of code that maybe can make me explain better
I'm not really sure if thats the best way to do it, and maybe i'm being a headache for you! forgive me! Thanks a LOT! |
if you are online. Join me here |
Ok, if im not mistaken, I think you might be doing something wrong. JTAppleCalendar is like a UITableView. In a UITableview, you have a in JTAppleCalendar, you have this function: calendar(calendar: JTAppleCalendarView, isAboutToDisplayCell cell: JTAppleDayCellView, date: NSDate, cellState: CellState) In this function (just like a UITableView), you get the dateCells for you to manipulate. You have your dataSource which is an array of You can take a look at the example project attached to this repository. |
I will close this issue as the original calendar enhancement is resolved. If you have any non-calendar related issues you can always chat here anytime 👍 If you have a new calendar issue/bug/enhancement then lets create a new issue for it. Thanks. |
HI!
First of all, amazing work! This is really a piece of art of code!
I want to achieve this behaviour that I saw on the examples thread here
I have an array with some range of dates, so i'm doing
Checking the code of
selectDates(from startDate:NSDate, to endDate:NSDate, triggerSelectionDelegate: Bool = true) { selectDates(generateDateRange(from: startDate, to: endDate), triggerSelectionDelegate: triggerSelectionDelegate)
I noticed thisThis is making that if a date is previous selected it will be deselected, and
cellSelectionChanged
is called withisSelected
on false, but to add the lines of the example I need to avoid that toggle behaviour.Maybe is there a way to achieve this already?
Do you have another approach to solve my problem?
PS:
I try using
calendar(calendar: JTAppleCalendarView, canDeselectDate date: NSDate, cell: JTAppleDayCellView, cellState: CellState) -> Bool
and returningfalse
but this didn't fix mi problemThanks again for the awesome work!
The text was updated successfully, but these errors were encountered: