Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Changing color of days in month view
posted

Hello,

I want to change the color of background in month view is it possible in igcalendarview ? 

Here is the screenshotSample

Parents
No Data
Reply
  • 21382
    Suggested Answer
    posted

    Helo Alekh,

    There isn't an easy way to do this at this time in the product.  I have added a suggestion in our suggestion system for this to be added as a feature in the future.  If you could go to this link

    http://ideas.infragistics.com/forums/211525-nuclios/suggestions/6699032-calendar

    And vote for the idea, when the product managers go through the ideas they can see which customers would like the feature.

    However there is a workaround which you could use, but it would be a bit clunky.  

    If you implement the IGCalendarViewDelegate and subsequently the following method

    -(void)calendarView:(IGCalendarView *)calView monthChanged:(NSDate *)date 

    Then you would be able to jump into the visual model and modify the colors directly.  If you navigate to the month view from the year view, all will look well.  If you scroll from month to month in the view however, the days won't color until the full month is shown as that is when the method is raised internally.   As I said this is a work around.

    -(void)calendarView:(IGCalendarView *)calView monthChanged:(NSDate *)date

    {

        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);

        

        int howManyDaysInMonth = objc_msgSend(dateInfo, @selector(numberOfDays));

        

        for (int i = 1; i <= howManyDaysInMonth ; i++)

        {

            objc_msgSend(dateInfo, @selector(setCurrentDay:), i);

            

            UIView* monthViewDay = objc_msgSend(monthView, @selector(resolveMonthViewDayForDate:), dateInfo);

            

            monthViewDay.backgroundColor = [UIColor clearColor];

            

            if (i>15 && i<22)

                monthViewDay.backgroundColor = [UIColor orangeColor];        

        }

    }

Children
No Data