我们可以在 cordova 中识别 UIGesture(在 cordova 中显示本机侧边菜单的本机手势)
Can we recognise UIGesture in cordova (native gesture to reveal native side menu in cordova )
我正在开发一个 iOS 项目,我想在其中使用 cordova 应用程序中的本机侧边菜单。有什么方法可以使用本机滑动手势显示侧边菜单吗?
UIWebView 不能很好地与手势识别器配合使用,因此可能很难在 iOS 端获得 'native' 回调。
但是,您可以 detect a swipe in javascript。
cordova 应用程序看起来或感觉起来很少像本机应用程序。对于一些很好的应用程序,但如果你想要本机,那就去本机吧!
UIWebView
已经在使用 UIGestureRecognizers
,因此您必须将此代码添加到 class 添加手势识别器的位置
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES
}
正如 Stefan 所说,easier/better 使用 javascript 滑动 shows/hides 本机菜单
或者您可以使用本机 UIScreenEdgePanGestureRecognizer,因为它不会对现有 UIWebView
UIGestureRecognizers
造成任何问题
我正在开发一个 iOS 项目,我想在其中使用 cordova 应用程序中的本机侧边菜单。有什么方法可以使用本机滑动手势显示侧边菜单吗?
UIWebView 不能很好地与手势识别器配合使用,因此可能很难在 iOS 端获得 'native' 回调。
但是,您可以 detect a swipe in javascript。
cordova 应用程序看起来或感觉起来很少像本机应用程序。对于一些很好的应用程序,但如果你想要本机,那就去本机吧!
UIWebView
已经在使用 UIGestureRecognizers
,因此您必须将此代码添加到 class 添加手势识别器的位置
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES
}
正如 Stefan 所说,easier/better 使用 javascript 滑动 shows/hides 本机菜单
或者您可以使用本机 UIScreenEdgePanGestureRecognizer,因为它不会对现有 UIWebView
UIGestureRecognizers