iPhone: Eliminate the shadow effect when scrolling a UIWebView

In this last period I worked on three applications for Apple iPhone, virtually simultaneously. Two have already been approved by Apple and are located on the App Store: thefirst and iMakeLove .

TheFirst iMakeLove

In both applications have adopted the use of an object UIWebView to display the instructions.
The object UIWebView ilevato was really comfortable in this case. It allowed me to quickly view and a nice text, images, and accompanied, if anything else is displayed on a Web page (Flash on iPhone not included).

TheFirst

The object UIWebView is really versatile and needs very few settings to be used. The only defect is the presence of a mysterious shadow that appears when you make a scroll out of the area of ​​control is at the bottom than at the top:

UIWebView Shadow

After several searches I realized that this behavior depends on the SDK, especially the latest updates. And Apple has not released any official statement on how to remove it, on the contrary, he rejected as code is not allowed a series of hacks that make use of sensitive functions, or documenting. Eventually I gave up, both in terms of time, and because the solutions seemed all out of the box Apple.
Fortunately I got the solution, I hope fairly regular basis, which seems to solve the problem (thanks to Adolfo ):

1
2
3
4
5
6
/ / WebView is the control UIWebView
[ webView.subviews objectAtIndex : 0 ] ; id = scroller [webView.subviews objectAtIndex: 0];

UIView * subView in [ scroller subviews ] ) for (UIView * subView in [scroller subviews])
subView class ] description ] isEqualToString : @ "UIImageView" ] ) if ([[[subView class] description] isEqualToString: @ "UIImageView"])
; subView.hidden = YES;

As pointed out by Adolfo , however this is a hack that may stop working with future releases of the SDK.

There are no comments for this post

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL