Skip to content

Preferred way to use a variant of JNWCollectionViewCellBackgroundView #102

@crispinb

Description

@crispinb

In a project of mine I use a variant of JNWCollectionViewCellBackgroundView. I have very simple drawn cells that I want Core Animation to stretch nicely, so my variant (1) is supplied with a pair of CGImages (one per resolution) rather than an NSImage, (2) sets the CALayer's .contentsCenter to (0.5, 0.5, 0, 0) to make the stretch correct for my purposes, and (3) overrides viewDidChangeBackingProperties to select the right CGImage for the layer.

To get this working, I've just made these changes directly in my local JNWCollectionViewCell.m. If such a variation would be of wide enough interest to submit as a pull request, what would be the preferred way of allowing users to customise the cell background view in related ways?

The very simplest (and with smallest necessary change to JNWCollectionViewCell) would be to have something like a customBackgroundView property on JNWCollectionViewCell. If this was set, the framework would back off and leave the background view entirely to the user. Its only role would be to place the view correctly re frame and zorder.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions