Hi there
Is there a way to change the color for each appointment?To be more specific, I have a class that represents an appointment, and in the class ,a property that declares if the appointment has to be completed or not. So i want to put red color to the one category and green to another.
Ty in advance.
I have tried one solution check if it works for you or not :)
-(UIColor *)colorForAppointmentsInIGCalendarView:(IGCalendarView *)calView
{
NSLog(@"Getting colors for appointment ");
if (isRedAppointment)
return [UIColor colorWithRed:123.0f/255 green:255.0f/255 blue:212.0f/255 alpha:1];
else
return [UIColor colorWithRed:237.0f/255 green:91.0f/255 blue:36.0f/255 alpha:1];
}
-(void)calendarView:(IGCalendarView *)calView asyncAppointmentRequest:(IGCalendarAppointmentRequest *)request ofType:(IGCalendarAppointmentRequestType)requestType
[[[NSOperationQueue alloc]init] addOperation:[NSBlockOperation blockOperationWithBlock:^(void)
NSTimeInterval min = [request.start timeIntervalSince1970];
NSTimeInterval max = [request.end timeIntervalSince1970];
NSMutableArray* returnRedAppts = [[NSMutableArray alloc]init];
NSMutableArray* returnGreenAppts = [[NSMutableArray alloc]init];
for(NSDictionary* appt in dataArray)
if ([[appt objectForKey:@"RedColorDate"] isKindOfClass:[NSDate class]])
NSDate* startTime = appt[@"startDate"];
NSDate* endTime = appt[@"endDate"];
NSTimeInterval current = [startTime timeIntervalSince1970];
NSTimeInterval currentEnd = [endTime timeIntervalSince1970];
if((current >= min && current <= max) || (currentEnd >= min && currentEnd <= max) || (current <= min && currentEnd >= max) )
IGCalendarAppointment* calAppt = [[IGCalendarAppointment alloc]init];
calAppt.startTime = startTime;
calAppt.endTime = endTime;
calAppt.location = appt[@"location"];
calAppt.title = appt[@"title"];
[returnRedAppts addObject:calAppt];
if ([[appt objectForKey:@"GreenStartDate"] isKindOfClass:[NSDate class]])
[returnGreenAppts addObject:calAppt];
[[NSOperationQueue mainQueue] addOperation: [NSBlockOperation blockOperationWithBlock:^(void)
isRedAppointment = TRUE;
NSArray* appts = [NSArray arrayWithArray:returnRedAppts];
[request provideAppointments:appts];
}]];
isRedAppointment = FALSE;
NSArray* appts = [NSArray arrayWithArray:returnGreenAppts];
]];
Hi,
Currently, no.
However, I did add that feature and it will be in the next SR.
Basically, when you create an IGCalendarAppointment, there is a new property called color, which you can set.
-SteveZ