1

我有一个 UIWebView,它使用以下代码应用了圆角:

self.bodyWebView = [[UIWebView alloc] initWithFrame:webViewFrame];
self.bodyWebView.backgroundColor     = [UIColor clearColor];
self.bodyWebView.delegate            = self;
self.bodyWebView.scalesPageToFit     = YES;
self.bodyWebView.scrollView.bounces  = YES;
self.bodyWebView.scrollView.delegate = self;
self.bodyWebView.scrollView.layer.backgroundColor = [UIColor scrollViewTexturedBackgroundColor].CGColor;
self.bodyWebView.layer.cornerRadius = 3.0;
self.bodyWebView.clipsToBounds = YES;
self.bodyWebView.layer.shadowColor = [UIColor grayColor].CGColor;
self.bodyWebView.layer.shadowOffset = CGSizeMake(0.0,1.0);
self.bodyWebView.layer.shadowRadius = 1.0;
self.bodyWebView.layer.shadowOpacity= 1.0;
self.bodyWebView.layer.opacity = 1.0;

我发现这正确地绘制了带有圆角的 UIWebView 但是在 iPad 上,当我使用以下代码在顶部显示视图控制器时会发生这种情况:

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
navigationController.modalPresentationStyle = UIModalPresentationPageSheet;
self.navigationController presentModalViewController:navigationController animated:YES];

发生的情况是,在 iPad 上,从底层 UIWebView 到 UIWebView 上方显示的视图控制器存在颜色溢出。这可以通过删除 clipsToBounds=YES 来解决,但此时 UIWebView 会失去其圆角。

我想知道是否其他人已经看到了这个,以及这是否可以修复?

4

0 回答 0