Iphone – Can you force a touch event to cancel after touchesBegan

cocoa-touchiphone

Given a certain state of one of my UIViews I'd like it to respond to touchesBegan and then cancel any further touchesMoved/Ended that continue from that particular touchesBegan event.

Basically I have an UIView subclass at rest and if it's touched I'd like to move some other UIViews out of the way… then the next time it's touched the responder chain can respond normally to touchesMoved/Ended…

yes, i could check for this state in touchesMoved/Ended but I'm wondering if there's a way to just derail that touch event mid-phase.

Best Answer

    let fakeTouch:Set<NSObject> = [UITouch()]
    let event     = UIEvent()

    self.touchesEnded(fakeTouch, withEvent: event)
Related Topic