Ich versuche, Knöpfe zu erstellen, die aus einer Menüschaltfläche hervorgehen (ähnlich der Schaltfläche + auf Pfad) und UIDynamicAnimator zu verwenden, um die ein- und ausgehenden Schaltflächen zu animieren. Es funktioniert und der Code ist sehr einfach.UIDynamicAnimator Sequentielle Animation
_animator = [[UIDynamicAnimator alloc] initWithReferenceView:sender.superview];
UIDynamicItemBehavior *resistance = [[UIDynamicItemBehavior alloc] initWithItems:@[_cartBtn, _chatBtn, _eventBtn]];
resistance.resistance = 5.0f;
[_animator addBehavior:resistance];
CGFloat radius = 75;
CGPoint target = sender.center;
target.x += radius * cos(GLKMathDegreesToRadians(265));
target.y += radius * sin(GLKMathDegreesToRadians(265));
UISnapBehavior *snapBehavior = [[UISnapBehavior alloc] initWithItem:_cartBtn snapToPoint:target];
[_animator addBehavior:snapBehavior];
target = sender.center;
target.x += radius * cos(GLKMathDegreesToRadians(225));
target.y += radius * sin(GLKMathDegreesToRadians(225));
UISnapBehavior *snapBehavior2 = [[UISnapBehavior alloc] initWithItem:_chatBtn snapToPoint:target];
[_animator addBehavior:snapBehavior2];
target = sender.center;
target.x += radius * cos(GLKMathDegreesToRadians(185));
target.y += radius * sin(GLKMathDegreesToRadians(185));
UISnapBehavior *snapBehavior3 = [[UISnapBehavior alloc] initWithItem:_eventBtn snapToPoint:target];
[_animator addBehavior:snapBehavior3];
Damit erscheinen alle drei Tasten zusammen. Was ich frage, ob es möglich ist, die Knöpfe animieren nacheinander mit UIDynamicAnimator, oder etwas anderes, aber so einfach?