How to disable UIWebview horizontal scrolling?

前端 未结 7 1232
长情又很酷
长情又很酷 2021-02-05 14:48

I\'ve tried disabling it by inserting:


into my HTML string, and a dozen variations of th

7条回答
  •  忘了有多久
    2021-02-05 15:15

    Set the delegate for the UIWebview's UIScrollview (on iOS5 by webview.scrollView and on iOS4 by traversing the subview tree and selecting the UIScrollview subview) to 'self' and use the following code:

    -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
        [scrollView setContentOffset:CGPointMake(0, scrollView.contentOffset.y)];
    }
    

    Works perfectly, for some reason my HTML code was overflowing horizontally without any need for it. This fix it.

提交回复
热议问题