views:

667

answers:

3

I would like to hide the native scrollbar / scroller that appears when you are scrolling a UIWebView, but still keep the scrolling functionality intact. Is this possible?

Thanks in advance,

William

+1  A: 

UIWebView doesn't inherit directly from UIScrollView, but you may be able to use UIScrollView properties on the UIWebView subview:

[(UIScrollView*)[webview.subviews objectAtIndex:0] setShowsHorizontalScrollIndicator:NO];
[(UIScrollView*)[webview.subviews objectAtIndex:0] setShowsVerticalScrollIndicator:NO];

No idea if this is acceptable, but it builds okay and I think it should work. Please report back if this works for you.

Also consider filing a feature request to Apple at bugreport.apple.com to add this property to a future UIWebView implementation.

Alex Reynolds
A: 

The code above didn't work for me. It crashes when a webview is clicked. It's hard to typecast something that is structurally on the same level.

Panagiotis
A: 

There's seems to be the beginning of an answer here :

http://discussions.apple.com/thread.jspa?threadID=1781730

If you disable user interaction, this seems to remove the scrollbar (this may be ok if the web page you display does not exceed the screen height).

A kind of javascript hack seems to be described also but I'm not mastering it :/ (you need to have access to the web page you try to display however, and this may not be your case....)

yonel