Skip to content

Commit 6f04288

Browse files
author
Zac White
committed
Addressed some possible delegate messaging problems.
1 parent d2fb4b8 commit 6f04288

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Drag/DKDragDropServer.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ - (void)dk_handleLongPress:(UIGestureRecognizer *)sender {
289289
if (droppedTarget) {
290290
CGPoint centerOfView = [[droppedTarget.dropView superview] convertPoint:droppedTarget.dropView.center toView:[self dk_mainAppWindow]];
291291

292+
// TODO: Fix this message.
293+
if ([droppedTarget.dropDelegate respondsToSelector:@selector(dropCompletedOnTargetView:withView:)]) {
294+
[droppedTarget.dropDelegate dropCompletedOnTargetView:droppedTarget.dropView withView:nil];
295+
}
296+
292297
// collapse the drag view into the drop view.
293298
[self dk_collapseDragViewAtPoint:centerOfView];
294299

@@ -440,11 +445,11 @@ - (void)dk_messageTargetsHitByPoint:(CGPoint)point {
440445
if (CGRectContainsPoint(target.frameInWindow, point)) {
441446
//message the target.
442447

443-
//TODO: Make the DKDropTarget message the view?
444-
445448
[self dk_setView:target.dropView highlighted:YES animated:YES];
446449

447-
if (!target.containsDragView) [target.dropDelegate dragDidEnterTargetView:target.dropView];
450+
if (!target.containsDragView && [target.dropDelegate respondsToSelector:@selector(dragDidEnterTargetView:)]) {
451+
[target.dropDelegate dragDidEnterTargetView:target.dropView];
452+
}
448453

449454
target.containsDragView = YES;
450455

@@ -453,7 +458,9 @@ - (void)dk_messageTargetsHitByPoint:(CGPoint)point {
453458

454459
[self dk_setView:target.dropView highlighted:NO animated:YES];
455460

456-
if (target.containsDragView) [target.dropDelegate dragDidLeaveTargetView:target.dropView];
461+
if (target.containsDragView && [target.dropDelegate respondsToSelector:@selector(dragDidLeaveTargetView:)]) {
462+
[target.dropDelegate dragDidLeaveTargetView:target.dropView];
463+
}
457464

458465
target.containsDragView = NO;
459466
}

0 commit comments

Comments
 (0)