I'm calling a method passing two arrays to it as follow :
NSArray *marked_dates = [NSArray arrayWithObjects:[dateFormat dateFromString:@"19/03/2014"],[dateFormat dateFromString:@"17/04/2014"],[dateFormat dateFromString:@"12/02/2014"], nil];
NSArray *marked_colors = [NSArray arrayWithObjects:[UIColor greenColor],[UIColor greenColor],[UIColor greenColor],nil];
[calendar markDates:marked_dates withColors:marked_colors];
Below is the method receiving this :
-(void)markDates:(NSArray *)dates withColors:(NSArray *)colors {
self.markedDates = dates;
self.markedColors = colors;
NSLog(@"%@",[NSString stringWithFormat:@"%d",[dates count]]);
for (int i = 0; i<[self.markedDates count]; i++) {
NSLog(@"%@",[NSString stringWithFormat:@"%@", self.markedDates[i]]);
}
[self setNeedsDisplay];
}
The log says 0 and I obviously don't get into the for
loop.
Thanks for any help.
EDIT : I will also vote up for any information about the warning : "format string is not a string literal"
Below the declaration of the properties :
@property (nonatomic, retain) NSArray *markedDates;
@property (nonatomic, retain) NSArray *markedColors;
EDIT :
So yes, the formater gives null values. Here is how I did it :
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy"];
NSLog(@"%@",[NSString stringWithFormat:@"%@",[dateFormat dateFromString:@"19/03/2014"]]);
//this prints "null"
EDIT with solution :
Bad mistake, I misconfigured the formatter using this worked for me, thank you all for your help.
[dateFormat setDateFormat:@"dd/MM/yyyy"];