Questions tagged [uigravitybehavior]

A gravity behavior specifies a gravity vector that applies to all of its dynamic items.

A gravity behavior specifies a gravity vector that applies to all of its dynamic items.

A dynamic item is any iOS or custom object that conforms to the UIDynamicItem protocol. The UIView and UICollectionViewLayoutAttributes classes implement this protocol starting in iOS 7.0. You can use a custom object as a dynamic item for such purposes as reacting to rotation or position changes computed by a dynamic animator—an instance of the UIDynamicAnimator class.

18 questions
3
votes
0 answers

Adding Gravity behavior to multiple objects in Swift

I am building a game in which there are lots of square blocks floating around the screen, bouncing off each other, walls, etc until they get destroyed. Currently, I have a master UIGravityBehavior and I add each square (a UIView class called…
Jeremy Toeman
  • 81
  • 1
  • 1
  • 7
1
vote
1 answer

How to make UIImageView animation wait for dynamicAnimator behavior to finish to start animating

I'm working on an animation for an app, where a shoe box falls from the top of the screen and lands on a pedestal, then the box opens. I was wondering if there was any way to make the animation for opening the box to wait for the box to get settled…
1
vote
1 answer

How would I make a gif jump, while implementing gravity and a ground y-variable?

CatBus Code Link I'm trying to make my gif "jump", while also coming back to rest at a y value of 730. No more, no less. It would work to the same extent as the Dinosaur game, when the wifi is out. I'd like to include a gravity function as well. I'm…
1
vote
2 answers

Accessing the number of elements in an array and applying gravity behaviour

I'm having issues with getting ALL elements of an array to fall using the Gravity module. I have managed to get the LAST element in the array to fall and then the remaining elements just stay at the top of the screen during testing. Upon debugging I…
user5524287
1
vote
0 answers

UIImageView "jump" animation

In Swift (without SpriteKit etc.) I've created a UIGravityBehavior for a picture which I actually want to jump if I click - like Flappy Bird but maybe a bit more smooth -and now I need to know how I can let my UIImageView look like it's jumping.
1
vote
0 answers

UIViews flickering when gravity angle is adjusted?

So, I'm about to submit my first app to the App Store, but I'm having an issue with UIView handling. My app adjusts the angle of a UIGravityBehavior (which is applied to UIViews), and everything is fine, but when the ViewController containing the…
1
vote
1 answer

Swipe UIView off screen

I'd like to be able to have a UIView (or, if necessary, UIViewController), which can be 'dragged'/flicked/swiped off screen - but locked to the vertical axis (so the view would go up or down off the screen to show the view below). This is sort of…
Jack Solomon
  • 880
  • 1
  • 8
  • 19
1
vote
1 answer

Cant get CoreMotion data in UIKit UIGravityDirection vector

So im trying to make an app for a school project in Swift. (im completely new to this language) The app should allow you to tilt your device, and by doing so making a square drop to the bottom of the screen. This is what ip using right now: func…
Krapton
  • 45
  • 1
  • 10
1
vote
1 answer

how to add constant "drop" speed instead of gravity

I have a game where blocks drop from the top using a gravity animation, i.e. acceleration. If I know want to change this speed to a constant speed. How would I do that? This would be my code to add gravity to a UIView which lets the object…
Timm Kent
  • 1,123
  • 11
  • 25
1
vote
1 answer

swift UIDynamicAnimator crash

Iam trying to to add a view to UIGravityBehavior (which I created graphicall by cmd+drag it to my code and creating an Outlet) but my app crashes , although when I create the same view in code and add it to my UIGravityBehavior it works perfectly !…
user3703910
  • 624
  • 1
  • 5
  • 25
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…
0
votes
1 answer

UICollisionBehavior and UIGravityBehavior not working as expected with DispatchQueue

I'm currently designing a UI for a framework I've been given that plays connect 4. This framework is encapsulated in a class called GameSession. I will not describe the ins and outs of it's API and how it operates. I don't believe it's important. I…
0
votes
1 answer

Have subviews using UIGravityBehavior have different gravity

I've got a viewController with a set of subviews. Currently, the gravity is the same for all of them. I want to be able to set different gravity direction values for each subview. Could someone show me how to do this? Thanks in advance EDIT:…
Big_Mac
  • 2,975
  • 4
  • 20
  • 36
0
votes
2 answers

Slider determines gravity

So far I've created a rectangle that starts from the bottom and moves upward using UiDynamicAnimator. I would like the user to determine the "strength" of the negative gravity. I want the user to determine the value through a slider. This is my…
Saud
  • 480
  • 1
  • 9
  • 26
0
votes
1 answer

UIViews Overlap after adding Gravity and Collision behaviour

I am trying to stack up uiviews on click of a button. I've also added Gravity & Collision behaviour using UIKit dynamics. The problem as you can see from the image (http://pho.to/7nVJI) is, the lower most green block and the block on top of that…
1
2