Question

I was wondering if anyone has had experience with dragging and dropping labels into a view and detecting if they collide or overlap. I was wondering how this can be done and also if they do collide/overlap that one of them is moved so its not overlapping.

Était-ce utile?

La solution

UIKit Dynamics is the way to go. Especially UICollisionBehavior. You can use gesture recognizers for dragging views. I created a demo project that does exactly what you are asking about.

It's available here:

https://github.com/r3econ/Collision-Behavior-Demo

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top