Calendar Month Grid: Custom image support #172

wants to merge 12 commits into


None yet

1 participant


For a project, I had a need to customise the look of the calendar. I thought this might be of interest to others. I implemented some callbacks that can be used on the Calendar Month View to provide images and image views that will make up the month view. Supports replacing the arrow images, the tile images, and the shadow/top images.

I'm not sold on the tile having the month view as its delegate and working out the tile images that way, but I've not thought up a better implementation just yet.

robelkin added some commits Jul 11, 2012
@robelkin robelkin made the monthYear ivar available as a property to make customisation…
… of it possible without subclassing

e.g. change text alignment, etc
@robelkin robelkin added delegate method definitions to get images and image views to cu…
…stomise images for the control
@robelkin robelkin defined new tiles delegate and had the month view adopt it fa934d4
@robelkin robelkin defined the delegate property on the month tiles object, and the opti…
…onal methods that make up the delegate
@robelkin robelkin moved the setup of the selected image view to the draw rect, so that …
…the call to self.currentDay would be able to use the delegate
@robelkin robelkin use the delegate to get the tile 3d2c2c9
@robelkin robelkin replace all calls to hard coded image paths with calls to the delegat…
…e, which in this case will be the owning month view
@robelkin robelkin implement the TKCalendarMonthTilesDelegate methods to check if the mo…
…nth view delegate is providing images, or if not we should just provide them ourselves.
@robelkin robelkin make sure that the tiles always have the delegate set to the month view
Bit dodgy, might need to think about this whole sub delegate pattern
@robelkin robelkin moved all the generation of the views/subview adding to the drawrect,…
… so it only happens when it has to, and so we have a chance to set the delegate method to override images
@robelkin robelkin check if the delegate exists and if we are getting an image back from…
… it, if we are then use it for our images, fall back to the bundle images
@robelkin robelkin provided examples of the new delegate methods in the demo dbcf5e1

Oh, and I made the title for the calendar available as a property so it can be manipulated (font changes, alignment etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment