问题
I am working on project where I want to integrate NSCalendar functionality in my app. Hence I googled and I found this solution. It give me all months in the year and also I can select particular date. that's fine. But I wanted to disable all saturdays and sundays of every month somehow I tried to do it but when I tap previous month or next month it changes the selection. I have gone through almost all stackoverflow questions But I didn't find proper way to do it. I request you to all Is there any flexible solution on this where I can disable weekends and any particular date. The flow should be like this:
- Run the application current month is display and all sat & sun disabled.
- When tap on next month or previous month, the respective sat & sun should be disable as per that month.
- Functionality for any particular date that I want to disable.
回答1:
Hello i updated the files and i created an array of disabled days please check the code form here
RootViewController.m file http://shorttext.com/l7iKEdf
RootViewController.h file http://shorttext.com/lFaath
just replace these files with the original files from the link you provided you will find that i added a disabledDays NSMutableArray add any integers to it to it like following 0 = sat 6 = friday and that day will be disabled
来源:https://stackoverflow.com/questions/10845688/nscalendar-find-saturday-and-sunday-of-current-month