当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - How to simulate a condition which is like UIPanGestureRecognizer's callback function

问题描述:

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];}

分享给朋友:
您可能感兴趣的文章:
随机阅读: