Silver Challenge - Would appreciate feedback


I appended the following if statement in touchesMoved method:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"%@", NSStringFromSelector(_cmd)); // Silver Challenge if (self.selectedLine) { self.selectedLine = nil; [[UIMenuController sharedMenuController] setMenuVisible:NO animated:YES];[/b] } ... ...

There is slight delay between fingers moving and line being drawn, which is more pronounced after this solution because selected line moves a little, before this method is triggered. I am not sure whats causing that. Any feedback would be appreciated.



Move the entire if block to touchesBegan: method and you should be fine. The reason slight movement is happening before your selected line gets deselected is because by the time the control reaches your if block, the new line to be made is already in progress.


I’m having the same problem. The code is in the touchesBegan method, but I still get the slight movement of the line before it stops.

EDIT: Found a solution to the problem: viewtopic.php?f=494&t=8253#p24232


Can someone please explain to me the logic behind this solution to the problem of the selected line moving for a fraction of a second?

This means that the moveRecognizer gesture recognizer will only be activated if the tapRecognizer fails. However, consider this scenario: You have a line drawn on the screen, and the line is selected, now you go to draw another separate line by placing your finger on the screen and dragging your finger. If I understand correctly, the latter action is not considered a tap, and so the tapRecognizer should fail.Therefore, the moveRecognizer should once again recognize a “move” action and cause the line that was selected to move for a fraction of a second. But, clearly, this doesn’t happen. Can someone please point out what part of this solution I’m misunderstanding?