NSCalendar查找本月的星期六和星期日 [英] NSCalendar Find Saturday and Sunday of Current Month

查看:79
本文介绍了NSCalendar查找本月的星期六和星期日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事要将NSCalendar功能集成到我的应用程序中的项目.因此,我用Google搜索,发现了解决方案.它给了我一年中的所有月份,也可以选择特定的日期.没关系.但是我想以某种方式禁用每个月的所有星期六和星期日,但是我尝试执行此操作,但是当我点击上个月或下个月时,它会更改选择.我已经经历了几乎所有的stackoverflow问题,但是我没有找到正确的方法来做到这一点.我要求所有人对此是否有任何灵活的解决方案,可以在此禁用周末和任何特定的日期.流程应如下所示:

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. 显示当前月份运行的应用程序,并且所有的&禁用太阳.
  2. 点击下个月或上个月时,相应的&该月应禁用sun.
  3. 我要禁用的任何特定日期的功能.

推荐答案

您好,我更新了文件,并创建了一系列的残疾日,请在此处检查代码表

Hello i updated the files and i created an array of disabled days please check the code form here

RootViewController.m文件 http://shorttext.com/l7iKEdf

RootViewController.m file http://shorttext.com/l7iKEdf

RootViewController.h文件 http://shorttext.com/lFaath

RootViewController.h file http://shorttext.com/lFaath

只需使用您提供的链接中的原始文件替换这些文件您会发现我添加了disabledDays NSMutableArray,并向其中添加了所有整数就像下面的0 =星期六6 =星期五那一天将被禁用

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

这篇关于NSCalendar查找本月的星期六和星期日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆