如何使用圆角矩形角进行webview?

Nic*_*Nic 8 iphone

我希望我的webview具有圆角矩形角.

有帮助吗?

luv*_*ere 15

这是如何做:

//first, you
#import <QuartzCore/QuartzCore.h>

//.....

//In your method, where you add your UIWebView, do:
UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(50, 220, 200, 100)];

//The rounded corner part:
webView.layer.cornerRadius = 5;
webView.clipsToBounds = YES;

//Load a web site:
[webView loadRequest: [NSURLRequest requestWithURL:
               [NSURL URLWithString:@"http://www.stackoverflow.com/"]]];

//yourView is the UIView's superview, might be the window, or anything you want
[yourView addSubview: webView];
[webView release];
Run Code Online (Sandbox Code Playgroud)

这使用QuartzCore框架,它只适用于> = OS 3.0