I have implemented a calendar view (GitHub). When you click on a day cell, a NSTableViewRow
is inserted below, containing details for the day.
Insertion and deletion is animated as NSTableViewAnimationSlideDown
and NSTableViewAnimationSlideUp
respectively. The standard AppKit components seem to simply vanish during the animation. That was weird enough for a few test labels, but Core Plot and it's CPTGraphHostingView
s don't play along nicely:
The plot view (containing 1 bar plot) appears outside the visible range of the row view and jumps into place once the row finished its animation. See animated GIF below:
The row view contains a custom view with 2 labels and 1 plot view. The custom view is pinned to all 4 edges of to the row view via AutoLayout (in code). I added Auto Layout constraints to the plot and labels relative to the edges of the parent custom view. I had hoped this would resize the plot according to the animation, but it doesn't seem to resize but move instead (slide not shrink).
How can I stick the plot view to the row's bottom during animation and clip it while the row slides?
Turned out it was an issue with Core Plot being based on CALayer
s, which don't animate well in a solely view-based table. After fiddling with different ideas for a while, I got it working with setWantsLayer:YES
, sent to the container view (not the NSTableView
! That didn't work out well).
This can be done in Interface Builder easily: