I'm working on a iOS project in which I want to use native side menu in cordova application. Is there any way to reveal side menu using native swipe gesture.
Asked
Active
Viewed 948 times
2 Answers
1
UIWebView doesn't play well with gesture recognizers, so it may be hard to get a 'native' callback on the iOS side.
You can, however, detect a swipe in javascript.
A cordova app will rarely look or feel like a native app. For some applications that's fine, but if you want native, go native!

Community
- 1
- 1

Stefan Kendall
- 66,414
- 68
- 253
- 406
1
UIWebView
is already using the UIGestureRecognizers
, so you have to add this code to the class where you add the gesture recognizer
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES
}
As Stefan said, is easier/better to use a javascript swipe that shows/hides the native menu
Or you can use the native UIScreenEdgePanGestureRecognizer, as it won't have any problem with existing UIWebView
UIGestureRecognizers

jcesarmobile
- 51,328
- 11
- 132
- 176
-
It worked for me .Thanks.. Is there any way to call javascript function after selecting the sidemenu item?? – iDeekshith May 18 '15 at 11:32
-
You can execute javascript from the native class using [self.webView stringByEvaluatingJavaScriptFromString:@"javascript code here"]; – jcesarmobile May 18 '15 at 11:42
-
post some code, that works because I use it in a lot of projects – jcesarmobile May 18 '15 at 13:12
-
stringByEvaluatingJavaScriptFromString: is working when i intercept fake url. But if i want to call javascript function without intercepting the url , its not working – iDeekshith May 19 '15 at 07:01
-
As I told you before, share the code you are using, create a new questios with it. It works because I use it. You can execute javascript code directly or even execute javascript functions you have already loaded in your apps javascript – jcesarmobile May 19 '15 at 07:04
-
this is the link to my new question http://stackoverflow.com/questions/30319548/calling-javascript-function-from-native-code-ios – iDeekshith May 19 '15 at 07:42