我有一个 UIWebView 并使用 QuartzCore 为其添加一些样式。但是当我执行时:
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];
我得到了一个更全面的 View ,但内容很清晰。有一种方法可以在 WebView 的内容中圆角
最佳答案
内容 View 实际上是scrollView
的 UIWebView
, 所以
webView.scrollView.layer.cornerRadius = 10;
关于objective-c - UIWebView 尖角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10699747/