本文介绍了如何在Tapku日历中的特定日期设置标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中,我使用Tapku日历在日历中显示日期。
In my application i use Tapku calendar to display a date in calender.
我想在日历中显示特定日期,例如
I want to display particular date in calendar like,
我的日期是2012-11-01而不是Marker来自2012-11-01的日历。
I have date 2012-11-01 than Marker comes on 2012-11-01 in calender.
请建议我我该怎么做使用Tapku caleder。
Please suggest me How can i do that with Tapku caleder.
推荐答案
- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate
{
[self generateRandomDataForStartDate:startDate endDate:lastDate];
return dataArray;
}
- (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{
// this function sets up dataArray & dataDictionary
// dataArray: has boolean markers for each day to pass to the calendar view (via the delegate function)
// dataDictionary: has items that are associated with date keys (for tableview)
NSLog(@"Delegate Range: %@ %@ %d",start,end,[start daysBetweenDate:end]);
self.dataArray = [NSMutableArray array];
self.dataDictionary = [NSMutableDictionary dictionary];
NSDate *d = start;
while(YES){
int r = arc4random();
if(r % 3==1){
[self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",@"Item two",nil] forKey:d];
[self.dataArray addObject:[NSNumber numberWithBool:YES]];
}else if(r%4==1){
[self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",nil] forKey:d];
[self.dataArray addObject:[NSNumber numberWithBool:YES]];
}else
[self.dataArray addObject:[NSNumber numberWithBool:NO]];
TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
info.day++;
d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
if([d compare:end]==NSOrderedDescending) break;
}
}
这篇关于如何在Tapku日历中的特定日期设置标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!