Show single event indicator per day

4 posts, 0 answers
  1. Sal
    Sal avatar
    58 posts
    Member since:
    Feb 2015

    Posted 13 Feb 2015 Link to this post

    So I wanted to know if there's a way to just show a single indicator under a day that has multiple events, similar to how the Calendar on the iPhone works. I thought if I added dayCell.style.maxEventsCount = 1; to my updatevisualsforcell method would do the trick but I guess that's not what it's for or I'm not doing it correctly. 
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 17 Feb 2015 Link to this post

    Hello Sal,

    Thank you for contacting us.

    Your assumption is correct. The maxEventsCount should restrict the number of events that are displayed in a single calendar cell. However, there is an issue and this property is not respected when using TKCalendar with the iPhone theme. We know about the issue and the good news is that it will be addressed in our upcoming release later this month. Until then you can work around the issue by using a custom cell and overriding its drawEvents:rect: method. Consider the sample below:
    @interface MyCell : TKCalendarDayCell
     
    @end
     
    @implementation MyCell
     
    - (void)drawEvents:(CGContextRef)context rect:(CGRect)rect
    {
        if (self.events.count > 0) {
            TKSolidFill *fill = [TKSolidFill solidFillWithColor:[UIColor redColor]];
            TKShape *eventShape = [TKPredefinedShape shapeWithType:TKShapeTypeCircle andSize:CGSizeMake(5, 5)];
            [eventShape drawInContext:context withCenter:CGPointMake(rect.size.width/2., rect.size.height-5) drawings:@[fill]];
        }
    }
     
    @end

    You should also adopt TKCalendarDelegate and implement its calendar:viewForCellOfKind: method to replace the cell:
    - (TKCalendarCell *)calendar:(TKCalendar *)calendar viewForCellOfKind:(TKCalendarCellType)cellType
    {
        if (cellType == TKCalendarCellTypeDay) {
            return [MyCell new];
        }
        return nil;
    }

    I hope this helps. Should you have any other questions, we will be glad to assist.

    Regards,
    Jack
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. DevCraft banner
  4. Sal
    Sal avatar
    58 posts
    Member since:
    Feb 2015

    Posted 17 Feb 2015 in reply to Jack Link to this post

    Thanks Jack, I'll go ahead and use a custom cell for now since we are still using the trial product and in the demo stage of how it will work with the rest of our app. Will probably purchase the product by the end of the week and will look out for the update. 
  5. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 18 Feb 2015 Link to this post

    Hi Sal,

    Thank you for this update. Do not hesitate to contact us if you have any questions.

    Regards,
    Jack
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner