我UIPanGestureRecogniser
在UIButton
s 上使用。我想检测它们中的两个何时以下列方式重叠:
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...
基本上发生的是用户将 a拖到屏幕上一系列 s 中的UIButton
任何其他上,这些 s 是 a 的一部分。当用户释放它们中的任何一个时,程序必须识别其中哪个重叠以及.UIButton
UIButton
dictionary
key
dictionary
我只能指定一个按钮,CGRectContainsPoint
而且我也不知道如何理解它是哪一个按钮并key
从dictionary
.