我多次使用此代码,但在我目前的项目中,它无效。这是错误(第三行): “'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;
}
}
答案 0 :(得分:1)
您正在寻找将UIGestureRecognizer作为父类的UIPanGestureRecognizer。
- (IBAction)panLayer:(UIPanGestureRecognizer *)pan{
}