Search code examples
iosobjective-cuiwebviewuiscrollviewuiscrollviewdelegate

Delegate methods of UIScrollView inside a UIWebView not called for horizontal scrolling


I have a UIWebView which has both horizontal and vertical content off the visible screen.

I set my controller to be the delegate of the UIWebView's UIScrollView, and noticed that when I scroll horizontally, scrollViewDidScroll, scrollViewDidScroll and scrollViewDidEndDecelerating are not called. They are called when I scroll vertically.

update: I also noticed there's no scroll bar when I scroll horizontally, but there is one when I scroll vertically. Also, scrolling horizontally doesn't bounce, even with alwaysBounceHorizontal = YES.

I am using a white-space: nowrap CSS style in my UIWebView. Could this be related?


Solution

  • Fixed this.

    Along with the white-space: nowrap styles, I also had overflow: auto. Removing that, achieved the same effect I wanted and now the horizontal scrolling works as I wanted.