我正在尝试移除加载和显示 .pdf 文件的 UIWebView 周围的阴影。我曾尝试实现 2010 年至 2013 年间发布的解决方案,但没有成功。我尝试过的解决方案包括:
self.contentWebView.layer.shadowOpacity = 0.0;
for (UIView* view in self.contentWebView.subviews)
{
view.layer.shadowOpacity = 0.0;
}
for (UIView* shadowView in [self.contentWebView.scrollView subviews])
{
if ([shadowView isKindOfClass:[UIImageView class]]) {
[shadowView setHidden:YES];
}
}
谢谢。
最佳答案
可能 duplicate of this ?很多解决方案,但最近的是:
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDiskImageCacheEnabled"];
[[NSUserDefaults standardUserDefaults] synchronize];
得票多的老一辈是:
-(void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
// Assuming self.webView is our UIWebView
// We go though all sub views of the UIWebView and set their backgroundColor to white
UIView *v = self.webView;
while (v) {
v.backgroundColor = [UIColor whiteColor];
v = [v.subviews firstObject];
}
}
关于iOS 从 UIWebView 移除阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29499306/