iOS:Tapku 日历库 - 允许为当月选择多个日期 [英] iOS: Tapku calendar library - allow selecting multiple dates for current month

查看:17
本文介绍了iOS:Tapku 日历库 - 允许为当月选择多个日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Tapku 库来实现日历.我可以看到有一种方法可以添加 Markers 用于预定义的开始和结束日期,但我希望允许用户从当前月份选择/取消选择任意数量的日期,并希望为每个操作生成事件.

I am using Tapku library for calendar implementation. I could see that there is a way to add Markers for predefined start and end date but I want to allow users to select/unselect any number of dates from current month only, and want to generate event for each action.

此外,我通过为左箭头和右箭头返回 nil 来关闭月份导航功能,以仅显示当前月份,但无法删除前几个月和下个月的事件 显示在当前月份的日期图块.我仍然可以选择上个月的第 31 天导航到上个月,或者选择下个月的第 1 天导航到下个月.请问我可以将日期选择限制为仅当月吗?

Moreover, I have switched off the month navigation functionality by returning nil for Left and Right arrow to display only current month but not able to remove events for few previous and next months Date tiles that gets displayed on current month. I can still select previous month's day 31st to navigate to previous month or select 1st on next month to navigate to next month. Can I restrict the date selection to only current month please?

谢谢.

推荐答案

TKCalendarMonthView.m 中通过以下方法处理触摸:

The touches are handled in TKCalendarMonthView.m in the following method:

- (void) reactToTouch:(UITouch*)touch down:(BOOL)down

查看第 563 行的块:

look at the block at row 563:

if(portion == 1)
{
    selectedDay = day;
    selectedPortion = portion;
    [target performSelector:action withObject:[NSArray arrayWithObject:[NSNumber numberWithInt:day]]];
}
else if(down)
{
    // this is the important part for you.
    // ignore it by adding a return here (or remove the following three lines)
    return;
    [target performSelector:action withObject:[NSArray arrayWithObjects:[NSNumber numberWithInt:day],[NSNumber numberWithInt:portion],nil]];
    selectedDay = day;
    selectedPortion = portion;
}

选择/取消选择可能无法如您所愿.它不像 setDateSelectedsetDateDeselected.. 而是有一个单独的 UIImageView*,代表选中状态.并且该视图被移动到当前位置.可以在代码中搜索self.selectedImageView看看,是怎么回事.

The selecting/deselecting perhaps doesn't work as you expect. It's not like setDateSelected and setDateDeselected.. instead there is a single UIImageView*, which represents the selected state. And that view is moved around to the current position. You can search for self.selectedImageView in the code to see, what is happening.

所以引入多日期选择并不容易.该架构不是为此而构建的.

So its not that easy to introduce multiple-date-selection. The architecture isn't built for that.

这篇关于iOS:Tapku 日历库 - 允许为当月选择多个日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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