Questions tagged [uidynamicbehavior]

A dynamic behavior confers a behavioral configuration on one or more dynamic items for their participation in two-dimensional animation.

52 questions
10
votes
1 answer

UIKit dynamic behavior pan with attachment not continuing collision behavior?

How do I have collision detection occur on the pan of a UIDynamicItem? Background: I'm generating 20 labels randomly from a set of colors/strings (this part is not essential to the question), and then adding them to the main view with a random…
BHendricks
  • 4,423
  • 6
  • 32
  • 59
9
votes
3 answers

UIKit Dynamics UICollisionBehavior collision without bounce

I have a view whose boundaries are set up for collisions (setTranslatesReferenceBoundsIntoBoundaryWithInsets) and a subview setup with gravity so that it can collide against the superview bounds. I'm trying to make the collision 0% bouncy, but I…
9
votes
3 answers

UIDynamicAnimator refuses to reach equilibrium when a UIGravityBehavior is active

I'm working on code for an expandable tray view that uses UIDynamicAnimator to achieve a nice expand/contract animation. To achieve a realistic acceleration I use UIGravityBehavior to make my tray fall, until the "tab" of the tray hits the bottom of…
Nailer
  • 2,446
  • 1
  • 24
  • 34
9
votes
2 answers

Slow down UISnapBehavior

I am using a UISnapBehavior but it is snapping too quickly for my liking. Is there a way to slow it down? Or in other words: is there a way to adjust the elasticity of the object with the point where it should snap to?
drewag
  • 93,393
  • 28
  • 139
  • 128
7
votes
3 answers

UIDynamicItem update transform manually

I know that external change to center, bounds and transform will be ignored after UIDynamicItems init. But I need to manually change the transform of UIView that in UIDynamicAnimator system. Every time I change the transform, it will be covered at…
xiaobo
  • 93
  • 8
5
votes
4 answers

UIGravityBehavior isn't working

I'm trying to learn UIKit Dynamics. I have created a box view and added the UIGravityBehavior on it, but nothing happens when I run the Project! Viewcontroller.m #import "ViewController.h" @interface ViewController () @end @implementation…
votelessbubble
  • 788
  • 6
  • 19
5
votes
3 answers

UIDynamics and Device Rotation

If I add any kind of UIDynamicBehavior to my views, it completely breaks things when the device is rotated. Here's what it is in portrait (displaying correctly): And here it is in landscape, all broke: I don't believe it's an autolayout issue…
swilliams
  • 48,060
  • 27
  • 100
  • 130
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

How to implement custom UIDynamicBehavior action

I have been looking for an example showing how to implement a custom UIDynamicBehavior in UIKit dynamics. All the tutorials and examples show only how to assemble a UIDynamicBehavior using primitives (collision, gravity, attachment, push, snap…
cridgit
  • 183
  • 8
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…
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

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
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
1 answer

iOS how to calculate transition duration when using UIDynamicAnimator for view controller transitions?

I'm modifying this example of using dynamic animators for view controller transitions. One of the things I want to do is make it work on iPad and change the direction of gravity transition from top down to right to left. I'm interested if there is a…
Alex Stone
  • 46,408
  • 55
  • 231
  • 407
1
2 3 4