我有一个带有HandlePan
方法的 ViewController:
-(void)handlePan:(UIPanGestureRecognizer *)gestureRecognizer
{
UIView *piece = [gestureRecognizer view];
[self adjustAnchorPointForGestureRecognizer:gestureRecognizer];
if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged) {
CGPoint translation = [gestureRecognizer translationInView:[piece superview]];
CGFloat panSpeed = (translation.x+translation.y)/2;
NSLog(@"PanSpeed %f",panSpeed);
[someview viewPan:panSpeed];
}
}
然后我UIView
调用someview
了这个方法:
- (void) viewPan:(float *)PanAngle {
NSLog(@"Panning...%@",PanAngle);
}
但我得到了一个nil
for PanAngle
。
这样做的正确方法是什么?谢谢!