gpt4 book ai didi

iOS:Tapku 日历库 - 允许为当月选择多个日期

转载 作者:行者123 更新时间:2023-12-01 18:30:21 25 4
gpt4 key购买 nike

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

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

谢谢。

最佳答案

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

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

查看第 563 行的 block :
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* ,表示选中状态。并且该 View 被移动到当前位置。您可以搜索 self.selectedImageView在代码中看看,发生了什么。

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

关于iOS:Tapku 日历库 - 允许为当月选择多个日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9686684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com