我有一个带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
获得PanAngle
。
这样做的正确方法是什么?谢谢!
答案 0 :(得分:2)
float不是对象,因此不需要指针
- (void)viewPan:(float)PanAngle{
NSLog(@"Panning...%f",PanAngle);
}