0
我試圖使用Tapku庫,我需要標記我有事件的日期。Tapku Library Marks從Api的日期
我的API resul是:
"month":08;
"calendarDays": [
"17",
"24"
]
下面是我的代碼:
- (NSArray*)calendarMonthView:(TKCalendarMonthView *)monthView marksFromDate:(NSDate *)startDate toDate:(NSDate *)lastDate {
NSMutableArray *marks = [NSMutableArray array];
SCCalenderElemDaysConnection *connection=[[SCCalenderElemDaysConnection alloc]init];
[connection obtieneListadoCalenderElemDays:^(SCCalenderElems *CalArr) {
self.CalenderDays=CalArr.calenderDays;
self.CalenderDays = [NSArray arrayWithObjects:
[NSString stringWithFormat:@"2013-09-%@ 22:00:00 +0000",[self.CalenderDays objectAtIndex:0]],@"2013-09-12 22:00:00 +0000", nil];
NSDate *d = startDate;
while(YES){
if ([self.CalenderDays containsObject:[d description]]) {
[marks addObject:[NSNumber numberWithBool:YES]];
} else {
[marks addObject:[NSNumber numberWithBool:NO]];
}
NSDateComponents *info = [d dateComponentsWithTimeZone:self.monthView.timeZone];
info.day++;
d = [NSDate dateWithDateComponents:info];
if([d compare:lastDate]==NSOrderedDescending) break;
}
NSLog(@"Marks %@",marks); // here marks have values
} :selectedMonth conToken:@"test" failure:^(NSError *error) {
NSLog(@"ERROR CALENDER DAYS %@",error);
}];
NSLog(@"MarkArray %@",marks); //marks null value
return [NSArray arrayWithArray:marks];
}
我的陣列進行塊是空的。我該如何解決這個問題?
在此先感謝。