2

我做了一个函数来处理复杂的布局。该函数由 UIPanGestureRecognizer 的回调函数驱动。幸运的是,它运行良好。现在,我想创建一个新的活动方法来调用该函数。问题来了:我可以模拟一个条件来调用函数而不做任何修改吗?

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

0 回答 0