ios - UIKit Dynamics: recognize rounded Shapes and Boundaries -


I am writing an app where I use UIKit dynamics to simulate the interaction of different circles with each other .

I will create my circle with the following circle:

  self = [super initWithFrame: CGRectMake (location.x - radius / 2.0, location A.a radius / 2, Radius, radius]]; If (self) {(self) Layer Set Corner Radius: Radius / 2.0.0]; Self.clipsToBounds = Yes; Self.layer.masksToBounds = Yes; Self.backgroundColor = color; Self.userInteractionEnabled = NO; } Healthy return;  

Where the location represents the desired location of the circle, and its radius represents the radius.

Then by adding these circles to various UIBehaviours:

  [_ collapse ed itam: circle]; [_gravity addItem: circle]; [_itemBehavior addItem: circle];  

The itemBaviour is defined as:

  _itemBehaviour = [[UIDynamicItemBehavior alloc] initWithItems: @ [class]]; _itemBehavior.elasticity = 1; _itemBehavior.friction = 0; _itemBehaviour.resistance = 0; _itemBehaviour.angularResistance = 0; _itemBehaviour.allowsRotation = NO;  

The problem I am facing is that my circles are behaving as sections. When killed in certain ways, they gain angular momentum and reduce the speed if they collide again, sometimes the angular momentum is turned again in motion, it looks normal for intersections. , But when the scene is round, like in my case, this behavior sounds weird and unnatural.

To turn on some debug options, I created this screenshot: The small circle is actually a Class is

As you can see, the circle is clearly a square.

So my question is, how can I create a UIVIEW which is actually a circle and will behave like UIIC in Dynamics?

OK, well before closing.

If you have enabled debug option to show areas of transparent cells it is a circle that the circle is actually a square with round edges.

All the scenes are rectangular. The way they look circular, make the corners transparent (hence the corner radius).

Secondly, what are you trying to do with UIKit Dynamics? What does the screen look like you are trying to make some kind of game?

Dynamics are used to make UI more natural and real-looking animations. This does not mean full physics engine.

If you want something like this, then you are using the best of the Sprite Kit.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -