Search code examples
iosuiviewuidynamicanimatoruigravitybehavior

Have subviews using UIGravityBehavior have different gravity


I've got a viewController with a set of subviews. Currently, the gravity is the same for all of them. I want to be able to set different gravity direction values for each subview. Could someone show me how to do this?

Thanks in advance

EDIT: Currently getting this output in the console "Multiple gravity behavior per animator is undefined and may assert in the future"


Solution

  • Created an array of UIDynamicAnimator and UIGravityBehavior objects and now it works