我有一個HandlePan
方法的視圖控制器:的UIViewController通float值的UIView方法
-(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
。
這樣做的正確方法是什麼?謝謝!
?在'someview.h'中使用' – rdelmar
',' - (void)viewPan;',在VC中,'#import「someview.h」'。然後我調用方法'[someview viewPan:panSpeed]'。 – sooon