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

iOS adding UIGravityBehavior to subviews does not always work

I'm adding UIGravityBehavior programmatically to subviews with but not always work. I have 4 views in main view with tags 101,102,103,104 as it shows in the image: but it seems like only works on view with tag 103 and 104 for some reason. Here is…
user2924482
  • 8,380
  • 23
  • 89
  • 173
0
votes
1 answer

UIDynamics collision not functioning on physical iphone

I implemented UIdynamics for objects (views) bouncing around the screen. On the simulator this works flawlessly, but but when testing on an actual iphone, the boundaries don't work. I will post code if necessary but this seems to me like im…
MingMan
  • 911
  • 1
  • 10
  • 31
0
votes
0 answers

UIAttachement behavior to make 2 views act like one view when dragging around

I have a little view that I would like to attach to a bigger view. When either of the views is dragged on the x axis I would like the other to move accordingly - as if they were one awkward shaped view I tried UIDynamicAnimator *animator =…
Avba
  • 14,822
  • 20
  • 92
  • 192
0
votes
1 answer

multiple gravitys or constant force in xcode UIDynamicAnimator

I realize sprite kit is the way to go for games, but i was wondering if there was way using UIDynamicAnimator to set up additional constant forces besides gravity. I am making a platform game and have set the gravity downwards. I have sections of…
MingMan
  • 911
  • 1
  • 10
  • 31
0
votes
1 answer

UITableViewCell frame isn't updated upon changes

I have a custom UITableViewCell to implement swiping horizontally with UIAttachmentBehavior and a UIPanGestureRecognizer. Here's the relevant portion, in the UITableViewCell subclass: - (void)panDidChange:(UIPanGestureRecognizer *)gesture { CGPoint…
0
votes
0 answers

UIGravityBehavior only rotate the view to follow gravity without falling

When adding a UIDynamicItem aka UIView to a UIGravityBehavior the object falls. I would like it to just rotate facing the earth without falling. How can I achieve this?
Nicolas Manzini
  • 8,379
  • 6
  • 63
  • 81
0
votes
1 answer

UIKit Dynamics add gravity/collision/bounce to relocate a subview

I'm trying to move down a subview using UIKit Dynamics. I need to move the subview to a particular position but it doesn't work it goes all the way down of the main view. Here is my code: UIView *mySubview = [self.view…
user2924482
  • 8,380
  • 23
  • 89
  • 173
0
votes
0 answers

Set Offset Animated With UIKItDynamics jumps

I have a collection view setup with UIKitDynamics Thanks to Here! I have implemented it in a horizontal scroller and am having some issues with animating scrolls to specify locations in the view. Any scrollTo:Animated: is having trouble it seems.…
WCByrne
  • 1,549
  • 1
  • 11
  • 16
0
votes
2 answers

UIDynamicItem with non-rectangular bounds

So I'm looking into UIKit Dynamics and the one problem I have run into is if I want to create a UIView with a custom drawRect: (for instance let's say I want to draw a triangle), there seems to be no way to specify the path of the UIView (or rather…
DanZimm
  • 2,528
  • 2
  • 19
  • 27
0
votes
1 answer

Find angle for UIPushBehavior with two CGPoints?

I am working on a project involving iOS 7 UIDyanmics and and UIPushBehavior. As part of this I am trying to calculate the angle (expressed in radians) of an object based on two CGPoints. In my research I've found this answer but its expressed in…
0
votes
1 answer

Clipping rectangular button frame to image mask for use with UIDynamics

I have three buttons on my screen which have background images set in storyboard, the background images are hexagonal shapes. I'm currently playing around with gravity, when a button is pressed I want them all to fall to the bottom of the screen. I…
0
votes
1 answer

Adding UIGravityBehavior and UIPushBehavior after a collision takes place in iOS 7

I'm messing around with the new physics API in iOS 7. I decided I would make a simple game, I have a character who can move around the screen at a tap of the finger, periodically, shapes fly up from the bottom and if they hit the character it's game…
Adam Carter
  • 4,741
  • 5
  • 42
  • 103
0
votes
1 answer

UICollisionBehavior memory leak

I've run into what I believe is a bug with UICollisionBehavior in UIKit. Adding them to an array of UIViews leads to a memory leak. I put together a simple demo project that creates 10 animations of a group of views falling with gravity applied, and…
Cosmo
  • 171
  • 1
  • 8
0
votes
0 answers

UIDynamics Gravity is not working

I want to apply gravity to a button when I get a success response from the server. I am creating the UIKitDynamics elements like this: -(void) setup { _animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; _gravity =…
john doe
  • 9,220
  • 23
  • 91
  • 167
0
votes
1 answer

iOS: UIDynamics Push Behavior

I have created this little animation using UIDynamics - Push Behavior. What I did was: I created a simple UIPushBehavior like so: self.pushBehavior = [[UIPushBehavior alloc] initWithItems:@[self.littleJumpy] mode:UIPushBehaviorModeInstantaneous]; …
Unheilig
  • 16,196
  • 193
  • 68
  • 98
1 2 3
13
14