translationInView无法正常工作

时间:2013-02-23 17:10:27

标签: xcode uigesturerecognizer

我多次使用此代码,但在我目前的项目中,它无效。这是错误(第三行):  “'UIGestureRecognizer'没有可见的@interface'声明选择器'translationInView:'

和我的简单代码:

- (IBAction)panLayer:(UIGestureRecognizer *)pan{
if (pan.state == UIGestureRecognizerStateChanged) {
    CGPoint point = [pan translationInView:self.view];
    CGRect frame = self.settingsView.frame;
    frame.origin.y = self.layerPosition + point.y;
    if (frame.origin.y < 0) {
        frame.origin.y = 0;
    }
}

1 个答案:

答案 0 :(得分:1)

您正在寻找将UIGestureRecognizer作为父类的UIPanGestureRecognizer。

- (IBAction)panLayer:(UIPanGestureRecognizer *)pan{
}