Barkley
Barkley

Reputation: 6713

Animating subviews in a stackview?

I'm trying to use the Spring animation framework to animate views within a stack view: https://github.com/MengTo/Spring

I understand how to get the animations working, but once I put my views into a stackview, the animations stop triggering.

I'm triggering the animations via an IBAction on buttons, and I've tried to create SpringButtons, and running the animation on a SpringView that holds the button as a subview. Neither options works.

Is it not possible to animate subviews of a stackview? Is the only option to layout each button individually with contraints?

Upvotes: 0

Views: 254

Answers (1)

TCool
TCool

Reputation: 163

I tried out the Spring demo project and was able to wrap the animated view in a UIStackView.

UIStackView with two SpringViews In this demo, it looks like they are keeping an IBOutlet reference to the SpringView within the SpringViewController like:

@IBOutlet weak var ballView: SpringView!

It sounds like your situation may be different if you are populating the stack view dynamically, but holding a reference to your SpringView instances should allow you to animate them within a UIStackView.

Upvotes: 2

Related Questions