NSCalendar Find Saturday and Sunday of Current Month

家住魔仙堡 提交于 2019-12-13 21:03:08

问题


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:

  1. Run the application current month is display and all sat & sun disabled.
  2. When tap on next month or previous month, the respective sat & sun should be disable as per that month.
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!