Remove UIWebView Shadow?

后端 未结 15 1210
慢半拍i
慢半拍i 2020-12-02 11:12

Does anyone know if its possible to remove the shadow that is placed on the UIWebView window?

Example: http://uploadingit.com/files/1173105_olub5/shadow.png

15条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 12:14

    Traverse all subviews, the UIImageViews whose image is only 1 pixel wide are shadow images, you can hide them.

    - (void)hideShadows {
        [webview traverseViewsWithBlock:^(UIView *view) {
            UIImageView *imgView = ([view isKindOfClass:[UIImageView class]] ? (UIImageView*)view : nil;
            // image views whose image is 1px wide are shadow images, hide them
            if (imgView && imgView.image.size.width == 1) {
                imgView.hidden = YES;
            }
        }];
    }
    

    traverseViewsWithBlock does what it looks like:

    - (void)traverseViewsWithBlock:(void (^)(UIView* view))block
    {
        block(self);
        for (id subview in self.subviews) {
            [subview traverseViewsWithBlock:block];
        }
    }
    

提交回复
热议问题