I have a CorePlot CPTXYGraph
in a CPTGraphHostingView
which is constrained by AutoLayout. I animate a constraint change (shrinking an adjacent view) that also causes the CPTGraphHostingView
to expand and would like the graph to animate its resizing along with the hosting view.
The constraint animation code is fairly boilerplate (see e.g. this SO question) and I'm using Swift:
self.view.layoutIfNeeded()
shrinkableViewHeightConstraint.constant = 100.0
UIView.animateWithDuration(
1.0,
animations: { () -> Void in
self.view.layoutIfNeeded()
})
What I actually see is the graph jumping to the new final size of the container view immediately while the animation proceeds normally. The end result is correct - the graph and container are the correct size - but I'd like a smoother transition with the graph updating its size (and maintaining its plotSpace) throughout the animation. Is this possible?
Note: I've tried removing the AutoLayout and manually animating the frame changes (I'd really prefer to use AutoLayout - there are a lot of other pieces to position) but the result is the same which makes me think it's related to CorePlot architecture (or the underlying plot CALayer
)