CPCDayCellRenderer
public protocol CPCDayCellRenderer
A type that is able to render a cell of a month view, representing an arbitrary day.
-
drawCell(in:)Default implementationFully renders content of cell, representing a specific day. Default implementation calls
drawCellBackground (in:)anddrawCellTitle (in:), in that order.Note
Graphical context is guaranteed to be cleared and than filled with background color forCPCDayCellState.normalinside cell’s frame.Important
Drawing code is not restricted by cell frame (e. g. graphical context is not clipped to this rect) but doing so may lead to undesired consequences. For example, border cells are implicitly clipped at some of their edges because redraw context does perform clipping that matches redrawn area.Important
Cell separators drawing code is called after cell content drawing code, so you shouldn’t worry that you can accidentally mess them up. Area under separators is not cleared before drawing so they do blend with anything that was drawn inside a cell.
Default Implementation
Declaration
Swift
func drawCell(in context: Context)Parameters
contextCell rendering context.
-
drawCellBackground(in:)Default implementationRenders background of a day cell. Default implementation calls
drawCellBackground (state:color:frame:in:)with corresponding values ofcontext.Default Implementation
Declaration
Swift
func drawCellBackground(in context: Context)Parameters
contextCell rendering context.
-
drawCellTitle(in:)Default implementationRenders title of a day cell. Default implementation calls
drawCellTitle (title:attributes:frame:in:)with corresponding values ofcontext.Default Implementation
Declaration
Swift
func drawCellTitle(in context: Context)Parameters
contextCell rendering context.
-
ContextExtension methodSee also
CPCDayCellRenderingContext.Declaration
Swift
public typealias Context = CPCDayCellRenderingContext -
drawCellBackground(state:color:frame:in:)Extension methodDefault implementation of day cell background drawing. Fills
frameofcontextwithcolorifstate!=CPCDayCellState.normal.Declaration
Swift
public func drawCellBackground(state: CPCDayCellState, color: UIColor?, frame: CGRect, in context: CGContext)Parameters
stateCell state.
colorTarget background color.
frameCell frame.
contextGraphics context to draw in.
-
drawCellTitle(title:attributes:frame:in:)Extension methodDefault implementation of day cell title drawing. Renders
titlewithattributesinframeofcontext.Declaration
Swift
public func drawCellTitle(title: NSString, attributes: NSDictionary, frame: CGRect, in context: CGContext)Parameters
titleCell title (day number).
attributesCell title attributes, e.g. foreground color or font.
frameCell title target frame.
contextGraphics context to draw in.
View on GitHub
Install in Dash
CPCDayCellRenderer Protocol Reference