UILongPressGestureRecognizer want to achieve at the touch of a loop execution time, release time to stop. Long press time at the beginning will see the State == UIGestureRecognizerStateBegan, loosen when State == UIGestureRecognizerStateEnded. How to allow users to perform a loop operation after pressing, and in the end when he loosened the cycle? ?
Reply:
Define a class Circle to do a class (if done in accordance with the needs of a single case)
There are two ways to put:
- (Void) start: (NSNotification *) noti;
- (Void) end: (NSNotification *) noti;
These two methods set up to receive Notification methods. Or delegate also OK;
Instantiated Circle (as a member)
Then when you click on the send notification methods start;
Loosen the time to send a notification method end;
Not have to use this method, but probably thinking it is.
Reply:
I use [self performSelector: _cmd withObject: nil afterDelay: 0.01] made a loop, so it will not block the main thread of the
Reply:
When the state received UIGestureRecognizerStateEnded [NSObject cancelPreviousPerformRequestsWithTarget: self] can to end this cycle of
No comments:
Post a Comment