Objective c 如何在导航栏中禁用手势识别器?
我有一个关于在nationBar中禁用手势识别器的问题Objective c 如何在导航栏中禁用手势识别器?,objective-c,xcode,uigesturerecognizer,Objective C,Xcode,Uigesturerecognizer,我有一个关于在nationBar中禁用手势识别器的问题 现在,我正在为iPad开发一个电子书应用程序。我使用uigesturecognizer实现翻页的效果。但我碰巧发现,如果我在屏幕顶部的导航栏中滑动,它也能工作。那么,如何在导航栏中禁用手势识别器,并在屏幕的其余部分启用它呢?假设您有导航栏的出口,您应该能够在手势处理方法中处理此问题 - (void)handleGesture:(UIGestureRecognizer *)gesture { if (CGRectContainsPoi
现在,我正在为iPad开发一个电子书应用程序。我使用
uigesturecognizer
实现翻页的效果。但我碰巧发现,如果我在屏幕顶部的导航栏中滑动,它也能工作。那么,如何在导航栏中禁用手势识别器,并在屏幕的其余部分启用它呢?假设您有导航栏的出口,您应该能够在手势处理方法中处理此问题
- (void)handleGesture:(UIGestureRecognizer *)gesture {
if (CGRectContainsPoint([myNavBar frame], [gesture locationInView:self.view])) {
// gesture occured in your navigation bar, so return;
return;
}
// continue with your normal code for handling the gesture;
}
如果你有一个导航栏的出口,你应该能够在手势处理方法中处理这个问题
- (void)handleGesture:(UIGestureRecognizer *)gesture {
if (CGRectContainsPoint([myNavBar frame], [gesture locationInView:self.view])) {
// gesture occured in your navigation bar, so return;
return;
}
// continue with your normal code for handling the gesture;
}
那应该对你有好处