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

Disable Multiple Cells according to Date Array #1319

Closed
SohaibSiddique opened this issue Apr 25, 2021 · 5 comments
Closed

Disable Multiple Cells according to Date Array #1319

SohaibSiddique opened this issue Apr 25, 2021 · 5 comments

Comments

@SohaibSiddique
Copy link

Hello All,

I have array with date strings in it I want to disable cells which equal to date string in array.

like date hides in the screenshoot.

is this possible with this library,

Screenshot 2021-04-25 at 9 21 30 PM

@patchthecode
Copy link
Owner

yes, just implement the shouldSelect delegate function.
And when the cell is tapped check the array to see if it exists in there.
If it exists, then return false else true.

@SohaibSiddique
Copy link
Author

yes, just implement the shouldSelect delegate function.
And when the cell is tapped check the array to see if it exists in there.
If it exists, then return false else true.

I was asking for dimming the cell not for selecting, btw I achieve this as bellow code

dateFormetter.dateFormat = "yyyy MM dd"
        dateFormetter.timeZone = calender.timeZone
        dateFormetter.locale = calender.locale
        
        let dateString = dateFormetter.string(from: cellState.date	)
        
        for date in availableDates {
            if date == dateString {
                cell.isUserInteractionEnabled = false
                cell.freezeView.isHidden = false
            }
        }

I put above code in cellForItemAt


but there is another thing which I want to achieve, I want to change cell color of previous dates, for example today is 25 April and all previous dates cell color should change.

@patchthecode patchthecode reopened this Apr 25, 2021
@vijay12345678910
Copy link

How can I show only two month calendar where user can select dates between them only and the rest of dates looks like unselected or disable

@patchthecode
Copy link
Owner

@SohaibSiddique this is done in the function where you setup your cell.
if the date is 25, set the color, else set another color.
I am not understanding the difficulty in this. I am wondering if i do not fully understand your question.

@SohaibSiddique
Copy link
Author

@SohaibSiddique this is done in the function where you setup your cell.

if the date is 25, set the color, else set another color.

I am not understanding the difficulty in this. I am wondering if i do not fully understand your question.

got that, its working fine now

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

3 participants