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
1
vote
3 answers

Interaction between UIDynamicAnimator and [UIView animateWithDuration:]

I'm attempting to animate a view into position in a view that's using UIDynamics. I'm not clear on the interaction between the Core Animation animations and UIDynamics but something's going on that I don't understand. I have a test project with a…
stevex
  • 5,589
  • 37
  • 52
1
vote
0 answers

Setting maximum fps on a Sprite/Image?

Specifically on a UIImageView. I'm using IOS7 dynamics and a "rope-like" dynamic, when I click and drag the image attached to the rope(Dragon*) it goes like 130 FPS(Just way to fast)! So I was wondering if there was some method that can make your…
1
vote
2 answers

UICollisionBehavior: Rolling Ball?

I am trying to work on an iOS iPhone app that uses UIKit Dynamics in order to do the physics animation. It's a basketball game where you can throw the ball into the hoop. However, I can't figure out how to make the ball circular (treated this way by…
Kjell
  • 801
  • 7
  • 19
1
vote
1 answer

UIAttachmentBehavior in UITableViewCell

I've added a horizontal UIPanGestureRecognizer to my tableviewcell to pan a subview of the cell, like the way the ios7 mail app does to reveal delete and more options and this works as expected - (IBAction)slideCell:(UIPanGestureRecognizer…
Andrew
  • 250
  • 1
  • 3
  • 10
1
vote
1 answer

UIDynamics - collision issue

Here is little question about UIDynamics. I have 8 square blocks laid out horizontally across the iPhone screen. Each square is 40 x 40. Since there are 8 of them, they fill up the width of the 320 screen. I guess the picture is clear. Now comes the…
0
votes
1 answer

Adjust offset with UIKit Dynamics

Reproduction can be found here I'm making a chat view that's pretty similar to Messages.app. A part of this is the bouncy messages made possible by UIKit Dynamics. I have gotten my implementation working pretty well after consuming every bit of…
Oscar Apeland
  • 6,422
  • 7
  • 44
  • 92
0
votes
0 answers

UICollisionBehavior not detecting when using collision with UIView.animate

I have properly set up UIDynamicBehavior and UICollisionBehavior however, none of my collisions are getting recognized as a hit in the delegate. I don't want to use UIGravityBehavior to handle my "falling" animations so I used UIView.animate instead…
swiftcode123
  • 105
  • 5
0
votes
0 answers

Swift UIKit Dynamics add collision boundary. After rotation does not work correctly

I have set some UIKit Dynamics boundaries for UIBezierPath of several UIImageView objects. block1path = UIBezierPath(rect: block1.frame) collision.addBoundary(withIdentifier: "block1" as NSCopying, for: block1path) However when I rotate the…
0
votes
1 answer

swift UIBezierPath collision boundary issues ( UIKit Dynamics )

Hi I have an app where the user can draw a bezier path with finger and it assigns this as a collision boundary for falling objects. It works!... But! It appears the Bézier curves are closing the path (hidden) and this also becomes a boundary. So if…
Guitarman4
  • 33
  • 5
0
votes
2 answers

How to make this floating views animation

How to make this floating views animation in swift uikit with uiviews each views doesn't collapse each other. each view position is random to 16 px and slow moving. I have tried with this code and calling push function several times import…
0
votes
1 answer

Swift UIImage cant be animated with gravity

I've looked into everything on Google, and that is not much. Is the community for Swift really this small??? I have an image, and on a long-press, I want it to fall down with gravity and hit the bottom of the screen. The error I get is Cannot…
Timmy
  • 52
  • 1
  • 2
  • 8
0
votes
1 answer

Unexpected Acceleration in Custom UIFieldBehavior

I'm creating a custom field to slow down the motion of objects after a user performs a pan gesture. Using normal friction makes the objects feel too slippery, so I'm trying to apply spring physics in place of friction. I have a function that seems…
sbrun
  • 197
  • 2
  • 13
0
votes
1 answer

UIKit Dynamics change a view frame with collisions

My project has several views that are subject to radial gravity at the center of their parent view, and elastic collisions so that they don't overlap. It works great, but sometimes I need to resize the views, and, when a view gets larger, the other…
user1272965
  • 2,814
  • 8
  • 29
  • 49
0
votes
1 answer

Bizarre Animation with UIDynamics After Delay

The Details: I am using DispatchQueue.main.asyncAfter(deadline: ... to update the snapPoint of a UISnapBehavior, which causes the view associated with the snap behavior to snap (with animation) to the new snap point. I want to update the snapPoint…
josephap
  • 2,075
  • 17
  • 24
0
votes
1 answer

Animate UICollectionView with UIDynamics Swift

In the Apple's own documentation, it states the steps on how to build that behavior, but I don't quite understand, can somebody tell me how to do that in code. To animate collection views, create an animator with the init(collection​View​Layout:​)…
Tom Xue
  • 470
  • 1
  • 7
  • 18