在 iPhone Web 应用程序中禁用滚动? [英] Disable scrolling in an iPhone web application?

查看:20
本文介绍了在 iPhone Web 应用程序中禁用滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以完全禁用 iPhone 网络应用程序中的网页滚动?我已经尝试了很多发布在 google 上的东西,但似乎都没有效果.

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;'

只需在应用程序的 mainViewController.m 文件的viewDidLoad"中添加这一行.您可以在 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆