问题描述:

I made a function to handle a complex layout . The function is driven by UIPanGestureRecognizer's callback function. Fortunately,it works perfectly.

Now,I want to creat a new active method to call the function. It comes the question :can I simulate a condition to call the function without any modification?

- (void)handlePan:(UIPanGestureRecognizer *)recognizer {

CGPoint translation = [recognizer translationInView:myParentView];

self.center = CGPointMake(self.center.x+translation.x,self.center.y);

isToLeft = (translation.x<0) ? YES : NO;

if ([self.delegate respondsToSelector:@selector(midMoveViewMove: transX:isToLeft:)]) {

[self.delegate midMoveViewMove:CGPointMake(self.frame.origin.x, self.frame.origin.y)

transX:translation.x

isToLeft:isToLeft];

}

[recognizer setTranslation:CGPointMake(0, 0) inView:myParentView];}

相关阅读:
Top