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. Nginx 第三方模块-漫谈缘起

    http://www.cnblogs.com/yjf512/archive/2012/03/30/2424726.html http://chenxiaoyu.org/2011/10/30/nginx ...

  2. GDI画验证码

    Random r = new Random(); string str = ""; for (int i = 0; i < 5; i++) { int a= r.Next(0 ...

  3. css的box-sizing:border-box有什么用

    css的box-sizing:border-box有什么用:视频说是多了的尺寸去掉了,适配box宽高

  4. Activity组件的UI实现

    Activity组件的UI实现需要与WindowManagerService服务和SurfaceFlinger服务进行交互 1. Activity组件在启动完成后,会通过一个类型为Session的Bi ...

  5. ubuntu下的supervisor启动express失败问题

    ubuntu下apt-get install nodejs后的启动命令是nodejs,而不同于windows下的node 所以我在supervisor启动express的时候出现了问题 提示如下: / ...

  6. PHP源代码分析(第一章):Zend HashTable详解【转】

    转载于http://www.phppan.com/2009/12/zend-hashtable/ 在PHP的Zend引擎中,有一个数据结构非常重要,它无处不在,是PHP数据存储的核心,各种常量.变量. ...

  7. 多目标遗传算法 ------ NSGA-II (部分源码解析)状态报告 打印 report.c

    /* Routines for storing population data into files */ # include <stdio.h> # include <stdlib ...

  8. java 资料收集

    java中线程队列BlockingQueue的用法 为什么jdk中把String类设计成final? 深入浅出单实例Singleton设计模式

  9. C++程序的构成和书写形式

    C++程序的结构和书写格式归纳如下:  (1) 一个C++程序可以由一个程序单位或多个程序单位构成.每一个程序单位作为一个文件.在程序编译时,编译系统分别对各个文件进行编译,因此,一个文件是一个编译单 ...

  10. 点击播放js

    <div class="videobox" id="videobox"> <img src="temp/pic1.jpg" ...