I need to change the cell background color when a user taps a cell in the month view. In MonthViewDayTapped, I'm currently returning false, to effectively disable the day view, since we don't need that. If there's no property/method, is there any trick I can use to set the cell color? Ideally, I'd be able to get to each of the UIView objects for each cell in the calendar somehow, and have full access, since not everybody is going to use a calendar to show appointments (show images, etc.), but the color would be nice to set in particular. Thanks!
Hi Michael,
Thats a great feature request, and one i think we can add easily enough.
It'd be really helpful if you aded it on our "ideas" page (which i believe you're familiar with)
http://ideas.infragistics.com/forums/211525-nuclios
We're always working to get those suggestions into our controls, for example the feature request, which you've commented on: IGCalendarView Appointment Colors is already implemented and was put into the last SR.
In the mean time, there is an unconventional way to get at the view you'd like to manipulate:
-(BOOL)calendarView:(IGCalendarView *)calView monthViewDayTapped:(NSDate *)date
{
_prevSelectedDayView.backgroundColor = [UIColor clearColor];
UIView* multiMonthView = [_cal valueForKey:@"_monthView"];
Class c = NSClassFromString(@"DateInfo");
id dateInfo = objc_msgSend(c, @selector(resolveInfoForDate:usingCalendarView:), date, calView);
UIView* monthView = objc_msgSend(multiMonthView, @selector(resolveMonthViewForDate:), dateInfo);
UIView* monthViewDay = objc_msgSend(monthView, @selector(resolveMonthViewDayForDate:), dateInfo);
monthViewDay.backgroundColor = [UIColor orangeColor];
_prevSelectedDayView = monthViewDay;
return NO;
}
Hope this helps,
-SteveZ
Steve,
I'm finally getting to try this out. If you have time, could you take a stab at converting your sample code above to C#? I haven't used the msgSend from Xamarin, so trying to get it working. Thanks!
Michael
I'll give this a try. I figured there was a way, but it looks like I would have needed to know more about the internals. I assume I should put a try/catch around this, since it probably can't be guaranteed this type of code can't break if the internal views change in the future. I did add a feature request for access cells just now. Thanks!