UIWebView默认允许当网页内容处于最顶端时,用户用手指往下拖动,然后露出空白的背景。这份代码能够禁止这种效果。
1
2
3
4
5
6
7
|
//Before iOS 5 for ( id subview in webView .subviews ) if ([[subview class ] isSubclassOfClass : [ UIScrollView class ]]) (( UIScrollView *)subview) .bounces = NO ; //After iOS 5 webView .scrollView .bounces = NO ; |