OGeek|极客世界-中国程序员成长平台

标题: javascript - 从 html 页面内部滑动手势在 UIWebView 中不起作用 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 12:05
标题: javascript - 从 html 页面内部滑动手势在 UIWebView 中不起作用

我有一个 UIWebView,它加载一个支持向左/向右滑动手势以在内容之间切换的 html 页面。此手势在从桌面浏览器打开页面时效果很好,但在从 UIWebView 加载时根本不起作用。

jQuery 滑动

适用于 IPHONE 和 IPOD TOUCH 移动应用程序

iPhone 和 iPod Touch 滑动手势支持使用 Safari JavaScript 实现 onTouchStart、onTouchMove、onTouchEnd 和 onTouchCancel。 这个插件使用 Mobile Safari 的内置触摸事件来允许 jQuery 将滑动事件绑定(bind)到任何 DOM 元素。当检测到手势时,您可以覆盖 swipeLeft 和 swipeRight 默认函数来创建自己的自定义进程。 这是用于刷卡的插件:http://archive.plugins.jquery.com/project/swipe

还有其他人遇到过这个问题吗? 任何帮助将非常感激!



Best Answer-推荐答案


//左滑

UISwipeGestureRecognizer * swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self actionselector(swipeleft)];
                    swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
                    [self.view addGestureRecognizer:swipeleft];

//向右滑动

UISwipeGestureRecognizer * swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self actionselector(swiperight)];
                    swiperight.direction=UISwipeGestureRecognizerDirectionRight;
                    [self.view addGestureRecognizer:swiperight];

方法

-(void)swipeleft{
}
-(void)swiperight{        
}

试试这个..

关于javascript - 从 html 页面内部滑动手势在 UIWebView 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17424992/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4