1

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 question:

When I apply a vertical gravity towards the bottom the blocks fall as I expect. But when I apply a lateral gravity (left or right) they move by about one pixel or two each. The last being therefore shifted by about 10 pixels or so. Why is that?

I use:

collisionBehave.translatesReferenceBoundsIntoBoundary=YES;

in my code.

I would expect the blocks not to move at all when I apply a lateral gravity.
I think I do not quite understand how the collisions between the moving parts is handled.

Thanks in advance for any tip.

Unheilig
  • 16,196
  • 193
  • 68
  • 98
Michel
  • 10,303
  • 17
  • 82
  • 179

1 Answers1

0

You have to set your 8 squares into UIDynamicItemsBehavior and set the density of this behavior.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52