Questions tagged [uikit-dynamics]

UIKit Dynamics is a feature introduced in iOS 7 that enables dynamic behaviors, which offers a way to enhance the user experience by incorporating real-world behaviors and characteristics, such as gravity, into your animations.

UIKit Dynamics is "a composable, reusable, declarative, real-world inspired animation, and interaction system" (as described in WWDC 2013 video, Getting Started with UIKit Dynamics).

Any object that conforms to the UIDynamicItem protocol, such as UIView objects, can be associated with "behaviors" that can be added to a dynamic animator, a UIDynamicAnimator. These behaviors include forces, elasticity, gravity, collisions, etc.

The types of behavior objects which can be added to the UIDynamicAnimator object include UIAttachmentBehavior, UICollisionBehavior, UIDynamicItemBehavior, UIGravityBehavior, UIPushBehavior, and UISnapBehavior. You can also combine these behaviors together or create your own custom dynamic behaviors.

UIKit Dynamics is not designed to replace Core Animation or UIView animations, but is designed to offer another mechanism to easily create more interactive and dynamic animations with less code. Likewise, UIKit Dynamics is not intended to replace SpriteKit, which might be better suited for many games.

Resources:

Related tags:

203 questions
4
votes
1 answer

How would I best use UICollisionBehavior to detect when a view is no longer on screen at all?

I'm trying to use UICollisionBehavior in UIKit Dynamics to figure out when a view that I've thrown off screen (using UIAttachmentBehavior and UIPushBehavior) is actually fully off screen. I'm finding it complicated because I'm not able to track it…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
4
votes
2 answers

Strange SpriteKit + UIDynamics Bug

So I'm developing a game using SpriteKit. And to make the game more interesting I decided to use UIDynamicAnimator to add some physics to the UIKit elements within my game. Everything works great except there is one major problem. The moment I…
Epic Byte
  • 33,840
  • 12
  • 45
  • 93
4
votes
1 answer

Dragging views using UIAttachmentBehavior

I would like to drag one UIView, and have it move the position of other views attached to it as if they were all attached via string. The starting state would be a bunch of UIViews clumped together. If you pull one out, the item it's attached to…
TheCodingArt
  • 3,436
  • 4
  • 30
  • 53
4
votes
1 answer

Using CGAffineTransformScale with UIAttachmentBehavior (UIDynamicAnimator)

In a subclass of UIButton, I attach the UIButton to a UIAttachmentBehavior that lets a user drag the button around the screen with their finger. In - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event I add the button to the…
4
votes
2 answers

UIKit Dynamics "SolveVelocityConstraints" crash

I keep getting a crash when using UIKit Dynamics. It doesn't happen every time the code runs, but it happens fairly often. Has anyone come across this? Assertion failed: (a.x >= 0.0f && a.y >= 0.0f), function SolveVelocityConstraints, file…
bmueller
  • 2,681
  • 1
  • 27
  • 45
4
votes
1 answer

How do you achieve the same animation as the iOS 7 Reminders app with UIKit Dynamics?

I am trying to achieve the animation behavior that mirrors the Reminders app in iOS 7 using UIKit Dynamics. However, I am struggling on how to achieve this effect. I have attempted to use UIAttachmentBehavior objects between current "card" and…
Shiun
  • 2,677
  • 1
  • 20
  • 20
3
votes
2 answers

Why is there memory leak / retain cycle after the action closure of UIDynamicBehavior is called?

The idea of the code here is to remove a view (self.mv) when it has been animated out of screen by a UIDynamicAnimator. The code below is based on examples from chapter 4 of the book Programming iOS 12 by Matt Neuburg. The author says both the…
LShi
  • 1,500
  • 16
  • 29
3
votes
1 answer

UICollisionBehavior with iOS9 seems to stop 1.5 points away from boundary: My bug or Apple's?

In my app, I use UIKit Dynamics including a UICollisionBehavior to have a menu bounce when it opens and when it closes. The code I'm using for this is below. This has been working fine for iOS8. With iOS9 (including iOS9.1 beta 2 just released),…
Chris Prince
  • 7,288
  • 2
  • 48
  • 66
3
votes
1 answer

UISnapBehavior strange jiggle - swift

I am trying to use UISnapBehavior to create a tweening back animation. I am trying to make a square draggable, then when the square is released, it tweens back to its original position. Each time it tweens back, it seems to have a strange trajectory…
3
votes
1 answer

Swift: UIDynamic animate panel from bottom to top

I want to build a simple custom view which slides up from the bottom with UIDynamicAnimator. When the app loads I offset the view from the screen using: panelWidth = originView!.frame.size.width panelHeight =…
Halfpint
  • 3,967
  • 9
  • 50
  • 92
3
votes
0 answers

UIKit Dynamics in iOS Control Center

I am simply trying to mimic the animation behaviour of iOS Control Center. I am trying to implement UIKit Dynamics in to an UI element. It's a panel sitting on the bottom half of the screen and I want it to slide up with a pan gesture and snap with…
Gizmodo
  • 3,151
  • 7
  • 45
  • 92
3
votes
0 answers

UICollectionViewFlowLayout snap cell into place with UIKitDynamics

I have subclassed UICollectionViewFlowLayout and I have in prepareForLayout added a attachment behavior between each of my cells, without any modification to the UIAttachmentBehavior so that it is just a rigid attachment. My plan was to then when…
Oscar Gomez
  • 18,436
  • 13
  • 85
  • 118
3
votes
1 answer

Performance Issue With UIKit Dynamics

Recently when I was playing with Stuart Hall's tutorial for UIKit Dynamics (http://stuartkhall.com/posts/flipcase-bounce-in-uikit-dynamics), I found there was a performance issue. After I added about 50 items (bouncing balls) to the animator, the…
Yuchen Wang
  • 1,682
  • 2
  • 14
  • 16
3
votes
3 answers

Disabling Vertical movement of UIAttachmnetBehavior in UICollectionView

Im trying mimic messages app spring animation in a horizontal UICollectionView I have used UIAttachmentBehavior in my UICollectionViewFlowLayout subclass. but the problem is that as I scrolls horizontally, cells also move vertically and horizontally…
3
votes
2 answers

UIKit Dynamics: recognize rounded Shapes and Boundaries

i am writing an App where i use UIKit Dynamics to simulate the interactions of different circles with one another. I create my circles with the following code: self = [super initWithFrame:CGRectMake(location.x - radius/2.0, location.y - radius/2,…
daniel f.
  • 1,421
  • 1
  • 13
  • 24
1 2
3
13 14