Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top