johnvuko / JTCalendar

A customizable calendar view for iOS.
MIT License
2.76k stars 535 forks source link

Circle more than one day #237

Open moemoe14 opened 8 years ago

moemoe14 commented 8 years ago

Hello,

I am trying to circle couple dates as events for example, and of course I want to do that on the monthly view, so how can I accomplish that?

Your help is appreciated.

judemorrissey commented 8 years ago

Hi, I know this is super late, but did you figure out your issue? I had to implement something quite similar, where each day on the calendar would be marked differently depending if something is happening that day. There's an example in the repository for multiple selection, but I think what you're looking for is more like what I have, where you "pre-select" dates as needed. You would want to implement the JTCalendarDelegate method func calendar(calendar: JTCalendarManager!, prepareDayView dayView: UIView!) (I'm using Swift btw) and modify the dayView as needed.

Here's an example snippet of code:

func calendar(calendar: JTCalendarManager!, prepareDayView dayView: UIView!) {
        {...}
        if (isSignificantDate(dayView.date)) {
            dayView.circleView.backgroundColor = .redColor()
            dayView.circleView.hidden = false
        }
        {...}
}

Here's how my calendar looks like, but do note that I subclassed JTCalendarDayView to add a UIImageView to use instead of the default circleView. I did start with using the circleView first to check that I'm getting the correct data, then moved on to implementing my custom day view. simulator screen shot jul 7 2016 4 53 09 pm