Pregunta

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.

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top