This solution may be a bit kludgy, but you could implement and manually call
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
I am basing this solution loosely on some tweaking I did to the MoveMe sample app on Apple's iPhone sample code site where I modified the touchesMoved
method to look like this:
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch view] == placardView)
CGPoint location = [touch locationInView:self];
placardView.center = location;
// I added the following line:
[self touchesCancelled:touches withEvent:event];
return;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…