在我的应用程序中,我使用Tapku日历在日历中显示日期。
我想在日历中显示特定日期,例如
我的日期是2012-11-01而不是Marker来自2012-11-01的日历。
请建议我如何使用Tapku caleder。
答案 0 :(得分:0)
- (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;
}
}