Enable Horizontal scrolling and disable Vertical scrolling:

myWebView.scrollView.delegate = self;
[myWebView.scrollView setShowsVerticalScrollIndicator:NO]; -(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y > 0 || scrollView.contentOffset.y < 0 )
scrollView.contentOffset = CGPointMake(scrollView.contentOffset.x, 0);
}

the 2nd line there will hide the vertical scroll indicator. Checking if "scrollView.contentOffset.y < zero" will disable the bouncing when you attempt to scroll downwards. You can also do: scrollView.bounces=NO to do the same thing!! By just looking at Rama Rao's answer i can tell that his code will reset the scrollView to (0.0) the moment you try to scroll vertically, thereby moving you away from your horizontal position, which is not good.

Enable vertical scrolling and disable Horizontal scrolling:

myWebView.scrollView.delegate = self;
[myWebview.scrollView setShowsHorizontalScrollIndicator:NO]; -(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.x > 0)
scrollView.contentOffset = CGPointMake(0, scrollView.contentOffset.y);
}

 

UIWebview 禁止某个方向滚动的更多相关文章

  1. 禁止uiscrollview垂直方向滚动,只允许水平方向滚动;或只允许垂直方向滚动

    禁止UIScrollView垂直方向滚动,只允许水平方向滚动 scrollview.contentSize =  CGSizeMake(你要的长度, 0); 禁止UIScrollView水平方向滚动, ...

  2. jquery弹窗时禁止body滚动条滚动

    当弹出一个jq提示窗口的时候,一般窗口右边还会有进度条的情况,禁止进度条方法禁止浏览器滚动条滚动: $('body').css({ "overflow-x":"hidde ...

  3. UIWebView禁止点击后跳转

    #pragma mark 禁止webview中的链接点击 - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRe ...

  4. 页面弹出全屏浮层或遮罩时,禁止底层body滚动

    · 解决方法 针对弹出的浮层的 touchmove事件,添加阻止浏览器默认行为. $('.mask-wrapper').on('touchmove', function (event) { // 监听 ...

  5. js处理局部scroll事件禁止外部scroll滚动解决办法,jquery.mousewheel.js处理时禁止办法说明

    js Code: <script> window.onload = function() { for (i = 0; i < 500; i++) { var x = document ...

  6. H5禁止页面滑动/滚动

    禁止页面滚动--完美解决方案,滚动条显示与否,手持设备兼容与否 禁止页面滚动 有三种方法 1,依靠css 将页面 document.documentElement.style.overflow='hi ...

  7. UIWebView 禁止检测链接弹出UIActionSheet

    解决方法一: 添加以下代码禁止检测类型 webView.dataDetectorTypes = UIDataDetectorTypeNone; 解决方法二: - (void)webViewDidFin ...

  8. js 禁止/允许页面滚动

    参考:https://blog.csdn.net/huangfu_chunfeng/article/details/46429997         https://www.cnblogs.com/w ...

  9. android禁止ScrollView自动滚动

    当Scrollview嵌套listview,或者子View的内容过多时,当内容加载完成后,ScrollView中内容的长度会发生改变,ScrollView会自动往下滚动,解决办法:在ScollView ...

随机推荐

  1. php安装过程中遇到的需要安装的问题

    http://www.cnblogs.com/kristain/articles/3809243.html     借鉴php安装错误 2013-01-04 19:16:49 分类: 系统运维 环境: ...

  2. Google Web Designer 测试

    这东东完全就是一个flash啊,简单测试,感觉就是个做HTML5动画的..不过暂时是beta版的, 官方安装版的半天打不开,这边有个绿色版的,需要的童鞋可以这里下载:百度网盘

  3. 由json生成php配置文件

    $str = '<?php return ' . var_export(json_decode($json, true), true) . ';';file_put_contents('./co ...

  4. QQ空间的“神奇”图片

    近几天好多朋友问我qq空间出现的神奇图片原理,最近比较烦,事情比较多,一直没理.加上我对PHP之类的语言也一知半解. 今天闲了看了一下QQ空间,发现这个很早以前就有人写过这样的帖子了 看别人解释 (转 ...

  5. Visual C++ 6.0常用快捷键

    一.常用编译相关的快捷键 1.编译(单个文件)  Ctrl+F7 2.连接 F7 3.运行  Ctrl+F5 二.常用调试相关的快捷键 1.GO(全速运行)  F5 2.Stop Debuging(停 ...

  6. jedis源码阅读

    package redis.clients.jedis; import java.util.ArrayList; import java.util.HashSet; import java.util. ...

  7. 一篇文章让你彻底搞清楚Python中self的含义

    刚开始学习Python的类写法的时候觉得很是麻烦,为什么定义时需要而调用时又不需要,为什么不能内部简化从而减少我们敲击键盘的次数? 你看完这篇文章后就会明白所有的疑问. self代表类的实例,而非类. ...

  8. leetcode 第二题Add Two Numbers java

    链接:http://leetcode.com/onlinejudge Add Two Numbers You are given two linked lists representing two n ...

  9. bzoj 3242: [Noi2013]快餐店 章鱼图

    3242: [Noi2013]快餐店 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 266  Solved: 140[Submit][Status] ...

  10. ruby面向对象class

    ruby对象是严格封装的:只能通过定义的方法访问其内部状态.方法使用的成员变量在对象外部不能直接访问,不过可以通过getter.setter等访问器方法(accessor),使他们看起来好像是直接访问 ...