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
2 answers

iOS: UIDynamicAnimator updateItemUsingCurrentState not working with rotation

I am trying to manually change rotation of a view in UIDynamics, but the view's rotation is always reset after update. The documentation says, that UIDynamicAnimator's updateItemUsingCurrentState: method should update position and rotation of an…
1
vote
0 answers

UICollisionBehavior not working in landscape mode

I have two methods, setupAnimation and startAnimating. I am using UIDynamics, specifically 4 separate UIDynamicAnimators with 4 separate UIGravityBehaviorseach containing just one item (because the gravity is in different directions for each), and…
1
vote
0 answers

Can't access method of UIGravityBehaviour

I was looking at WWDC Video Advanced Techniques with UIKit Dynamics. I tried to go through the explanation how to create a customized transition using UIDynamics. When the UIGravityBehavior will be created, they also use a method I can't access…
1
vote
0 answers

UIGravityBehavior Action in Swift

I am currently implementing a UIGravityBehavior to move a menu from the bottom to the screen that stops at the top and when pressing the button again I want it to move back and disappear at the bottom. var gravity : UIGravityBehavior =…
nizx
  • 690
  • 1
  • 6
  • 13
1
vote
1 answer

How do I find the lowest or highest point on a UIView being dragged with UIAttachmentBehavior?

Depending on where the anchorPoint is with UIAttachmentBehavior, the view can be quite rotated, so it's in more of a diamond shape than a square. In these situations, where it's rotated say 90°, how do I find what the lowest or highest point of this…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
1 answer

Difference between Core Animation and UIKit Dynamics in iOS

I have been recently working with UIKit Dynamics and its great! However I have come across that Core Animation also offers similar functions as that of UIKit Dynamics. Could someone help me differentiate between these two. Basically I need to…
user1882758
  • 155
  • 3
  • 13
1
vote
1 answer

How is length in UIAttachmentBehavior determined?

The documentation of the length property in UIAttachmentView is the following: Use this property to adjust the attachment length, if you want to, after creating an attachment. The system sets initial length automatically based on how you initialize…
Daniel Duan
  • 2,493
  • 4
  • 21
  • 24
1
vote
3 answers

How to attach 2 views inorder for them to pan as one view

I want 2 views to act as if they were "one view" - meaning if view 1 moves on the 'x' n pixels I want view 2 to move on the x axis the same amount of pixels (in any arbitrary direction) - without having to calculate all sorts of offsets and so on. I…
Avba
  • 14,822
  • 20
  • 92
  • 192
1
vote
1 answer

How to know when the pushed view stopped moving. UIKit Dynamics

I have a UIView on which I apply a UIPushBehavior of mode UIPushBehaviorModeInstantaneous. What is the easiest way to know when the pushed UIView stops moving?
Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
1
vote
1 answer

Does UIOffsetMake() use the traditional top left corner origin (0,0) or bottom left origin?

View geometry in UIKit specifies that it acts on an axis starting from the top left corner (0,0) and increasing in x and y as you travel toward the bottom right. UIOffsetMake() is used a lot in UIKit Dynamics, and I was wondering if it follows a…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
1 answer

Dragging UIView with UIAttachmentBehavior and auto layout constraints

I have a UIScrollView set up in IB with auto layout that contains an UIImageView. You can have a look at the Github repository of Evgenii to see how it is set up: https://github.com/evgenyneu/ios-imagescroll The scrollview is used to enable…
Cornelius
  • 4,214
  • 3
  • 36
  • 55
1
vote
1 answer

I'm struggling to implement a subclass of UIDynamicBehavior

I'm trying to move a UIView across the screen. UIGravityBehavior and UIPushBehavior both take things like density, velocity and friction into account. I tried to implement my own dynamic behavior that ignores those physics. My UIDynamicBehavior…
1
vote
2 answers

UIKit Dynamics: Attachment inside UITableViewCell

My table view cells contain a circle in an UIView, indicating a value. I want to add the UIKit Dynamics attachment behaviour to that circle in order to for it to lag a bit when scrolling. I don't want to attach the individual cells to each other but…
Paul
  • 999
  • 1
  • 12
  • 29
1
vote
4 answers

Collision not working between items

I'm using UIDynamics in my app. my app has two squares. one is fixed and the other can be moved (by applying a pan gesture). when i try to collide them they don't collide. the delegate methods never get called. here's my code and i hope someone can…
HusseinB
  • 1,321
  • 1
  • 17
  • 41
1
vote
1 answer

How to stop something with a UIGravityBehavior?

I have some UIViews that are using UIDynamicAnimation, specifically UIGravityBehavior. I need to know how to make them stop and start whenever I want to. I have been trying all sorts of combinations of manually setting the properties of the…
Le Mot Juiced
  • 3,761
  • 1
  • 26
  • 46