Detecting overlap with UIPanGestureRecognizer
I am using UIPanGesture recogniser on UIButtons. I want to detect when two
of them overlap in the following way:
if([(UIPanGestureRecognizer*)sender state] ==
UIGestureRecognizerStateEnded||[(UIPanGestureRecognizer*)sender state] ==
UIGestureRecognizerStateCancelled||[(UIPanGestureRecognizer*)sender state]
== UIGestureRecognizerStateFailed){
CGPoint fingerPoint;
for(id key in BluetoothDeviceDictionary) {
UIButton* btn = [BluetoothDeviceDictionary objectForKey:key];
fingerPoint = [(UIPanGestureRecognizer*)sender
locationInView:btn.superview];
}
//BLUETOOTH SHARING
if (CGRectContainsPoint(All buttons from dictionary.frame, fingerPoint)){
for the UIButton that has been overlapped do...
What is basically happening is that the user drags a UIButton on any other
UIButton on a series of UIbuttons on screen that are part of a dictionary.
When the user releases on any of them, the program has to recognise which
one of them has overlapped and the relative key from the dictionary. But I
am stuck in mud. I only can specify one button for CGRectContainsPoint and
I also don't know how to understand which one of the buttons it was and
get the key from the mutable dictionary.
No comments:
Post a Comment