简体   繁体   中英

Gravity with UIview

I drew a circle in UIView with a help of UIBezierPath . Then I added gravity behavior to that view using UIGravityBehavior and collision behavior using UICollisionBehavior . When the circle collides with other objects this view bumps as square, but I want to work with this view in collisions as with a circle. How can I do it?

提供截图

You can't use UIKit Dynamics to simulate a circle. It works with rectangular bodies only. You can add collision paths, but I think that is only for the reference frame. I recommend looking at SpriteKit's SKPhysicsBody . Unfortunately, I haven't used it, so I can't provide a code sample.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM