Wednesday, June 13, 2012

Transparent UIWebView

To transparent the UIWebView and remove the scrolls.

webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
for(UIView *view in webView.subviews){ 
     if ([view isKindOfClass:[UIImageView class]]) {
          // to transparent 
          [view removeFromSuperview];
     }
     if ([view isKindOfClass:[UIScrollView class]]) {
          UIScrollView *sView = (UIScrollView *)view;
          //to hide verticalScroller
          sView.showsVerticalScrollIndicator = NO;
          for (UIView* shadowView in [sView subviews]){
               //to remove shadow
               if ([shadowView isKindOfClass:[UIImageView class]]) {
                    [shadowView setHidden:YES];
               }
          }
     }
}

1 comment: