Reputation: 126
I have a UIWebView which loads an html page that supports swipe left/right gesture to switch between content. This gesture works well when the page is opened from a desktop browser but doesn't work at all when loaded from a UIWebView.
jQuery Swipe
FOR IPHONE & IPOD TOUCH MOBILE APPS
iPhone and iPod Touch swipe gesture support using Safari JavaScript for onTouchStart, onTouchMove, onTouchEnd and onTouchCancel. This plugin uses Mobile Safari's built in touch events to allow jQuery binding of swipe events to any DOM element. You can override the swipeLeft and swipeRight defaults functions to create your own custom process when the gesture is detected. This is the plugin used for swiping: http://archive.plugins.jquery.com/project/swipe
Did anyone else had this issue? Any help would be much appreciated!
Upvotes: 2
Views: 1065
Reputation: 5081
//For Left Swipe
UISwipeGestureRecognizer * swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft)];
swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeleft];
//For Right Swipe
UISwipeGestureRecognizer * swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight)];
swiperight.direction=UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swiperight];
Methods
-(void)swipeleft{
}
-(void)swiperight{
}
Try this one..
Upvotes: 1