禁用iPhone Web应用程序中的滚动? [英] Disable scrolling in an iPhone web application?
问题描述
有没有办法在iPhone网络应用中完全禁用网页滚动?我已尝试在谷歌上发布了很多内容,但似乎都没有。
Is there any way to completely disable web page scrolling in an iPhone web app? I've tried numerous things posted on google, but none seem to work.
这是我当前的标题设置:
Here's my current header setup:
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
document.body.addEventListener('touchmove',function(e){ e.preventDefault();});
似乎不起作用。
推荐答案
'self.webView.scrollView.bounces = NO;'
'self.webView.scrollView.bounces = NO;'
只需在'viewDidLoad'中添加这一行您的应用程序的mainViewController.m文件。你可以在Xcode中打开它并添加它。
Just add this one line in the 'viewDidLoad' of the mainViewController.m file of your application. you can open it in the Xcode and add it .
这应该使页面没有任何橡皮筋反弹仍然在应用视图中启用滚动。
This should make the page without any rubberband bounces still enabling the scroll in the app view.
这篇关于禁用iPhone Web应用程序中的滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!