我有一个带有QuartzCore的UIWebView,并使用它来添加一些样式。但是当我执行的时候:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 10, self.view.bounds.size.width-20.0, self.view.bounds.size.height-30.0)];
NSString *urlAddress = @"http://www.google.com/";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
webView.layer.cornerRadius = 10;
webView.layer.borderColor = [UIColor whiteColor].CGColor;
webView.layer.borderWidth = 3.0f;
[self.view addSubview:webView];我得到了一个圆角视图,但内容很清晰。在WebView中,有一种方法可以对内容中的角进行圆角处理

发布于 2012-05-22 18:09:59
内容视图实际上是UIWebView的scrollView,因此
webView.scrollView.layer.cornerRadius = 10;发布于 2012-12-07 13:20:06
同意@graver的回答,但不完全同意,因为他的工作不能在iPhone3G和第二代iPod上工作。
webView.layer.cornerRadius = 10;
[webView setClipsToBounds:YES];ClipsToBound将简单地调整webView下的所有子视图的大小。
https://stackoverflow.com/questions/10699747
复制相似问题