Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS:Tapku日历:需要选择多个日期_Ios_Date_Calendar_Tapku - Fatal编程技术网

iOS:Tapku日历:需要选择多个日期

iOS:Tapku日历:需要选择多个日期,ios,date,calendar,tapku,Ios,Date,Calendar,Tapku,我已经检查了一点Tapku日历代码,搜索并阅读了这里所有相关的问题和回答,但是似乎没有一个能真正提供问题的正确解决方案:如何通过编程或点击选择多个日期。只要在两个相邻的日期上贴上一块简单的蓝色瓷砖,我就会很高兴:-)下面的帖子似乎有一个类似的问题,但是答案不起作用。除非月份发生变化,否则代码中的位置不会被点击——这不完全是我想要的。最好是更高级别的selectDate实现:可以选择多个日期。但是在库中进行调整的正确位置是一个很好的开始,因为任何人都更熟悉代码。非常感谢 因此,在对代码进行了一点逐

我已经检查了一点Tapku日历代码,搜索并阅读了这里所有相关的问题和回答,但是似乎没有一个能真正提供问题的正确解决方案:如何通过编程或点击选择多个日期。只要在两个相邻的日期上贴上一块简单的蓝色瓷砖,我就会很高兴:-)下面的帖子似乎有一个类似的问题,但是答案不起作用。除非月份发生变化,否则代码中的位置不会被点击——这不完全是我想要的。最好是更高级别的selectDate实现:可以选择多个日期。但是在库中进行调整的正确位置是一个很好的开始,因为任何人都更熟悉代码。非常感谢


因此,在对代码进行了一点逐步检查之后,我使用锤子获得了这个基本方法。我采用了TKCalendarMonthView.m->selectDay:day方法中的大部分代码。我创建的方法基本上创建了一个新的TKCalendarMonttiles对象并填充详细信息,然后将子视图添加到主TKCalendarMonttiles对象(self)上。我标记子视图,以便在方法开始时可以首先除去它们,因为我只想再选择一天(如果希望子视图保留在UI中,则可以保留附加的子视图)。我不跟踪日期或存储日期或任何东西,但这符合我的需要

其思想是简单地创建一个视图,其中包含您想要使用的正确的平铺图像和一个包含实际“日期”文本标签(如“14”)的视图,然后将这些视图作为子视图添加到self中。借用的代码将对该日期平铺在网格中的“位置”进行所有计算,以便在正确的位置绘制视图。代码:

- (void)markDay:(int)day {

// First, remove any old subviews
[[self viewWithTag:42] removeFromSuperview];
[[self viewWithTag:43] removeFromSuperview];

int pre = firstOfPrev < 0 ?  0 : lastOfPrev - firstOfPrev + 1;
int tot = day + pre;
int row = tot / 7;
int column = (tot % 7)-1;

TKCalendarMonthTiles *deliveryTile = [[TKCalendarMonthTiles alloc] init];
deliveryTile.selectedImageView.image = [UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/MyDateTile.png")];
deliveryTile.currentDay.text = [NSString stringWithFormat:@"%d",day];

if(column < 0){
    column = 6;
    row--;
}

CGRect r = deliveryTile.selectedImageView.frame;
r.origin.x = (column*46);
r.origin.y = (row*44)-1;
deliveryTile.selectedImageView.frame = r;
deliveryTile.currentDay.frame = r;
[[deliveryTile selectedImageView] setTag:42];
[[deliveryTile currentDay] setTag:43];
[self addSubview:deliveryTile.selectedImageView];
[self addSubview:deliveryTile.currentDay];
} // markDay:
-(无效)标记日:(int)日{
//首先,删除所有旧的子视图
[[self-ViewWith Tag:42]从SuperView移除];
[[self-ViewWith Tag:43]从SuperView中移除];
int-pre=firstOfPrev<0?0:lastOfPrev-firstOfPrev+1;
int tot=日+日前;
int row=tot/7;
int列=(总计%7)-1;
TKCalendarMonthTiles*deliveryTile=[[TKCalendarMonthTiles alloc]init];
deliveryTile.selectedImageView.image=[UIImage imageWithContentsOfFile:TKBUNDLE(@“TapkuLibrary.bundle/Images/calendar/MyDateTile.png”);
deliveryTile.currentDay.text=[NSString stringWithFormat:@“%d”,天];
如果(列<0){
列=6;
行--;
}
CGRect r=deliveryTile.selectedImageView.frame;
r、 origin.x=(第46列);
r、 origin.y=(第44行)-1;
deliveryTile.selectedImageView.frame=r;
deliveryTile.currentDay.frame=r;
[[deliveryTile selectedImageView]设置标签:42];
[[deliveryTile currentDay]设置标签:43];
[自添加子视图:deliveryTile.selectedImageView];
[自添加子视图:deliveryTile.currentDay];
}//今天:
我在TKCalendarMonthView.m->selectDay:day的末尾调用此方法,在TKCalendarMonthView.m->-reactToTouch:down的末尾调用此方法。到目前为止,有限的测试还不错。去弄清楚为什么时区设置总是想着明天(我在太平洋时区)

干杯,迈克尔