I want my webview with Rounded Rectangle Corners.
我希望我的webview具有圆角矩形角。
Any help ?
有帮助吗?
2 个解决方案
#1
15
Here's how:
//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.*.com/"]]];
//yourView is the UIView's superview, might be the window, or anything you want
[yourView addSubview: webView];
[webView release];
This uses the QuartzCore framework, and it only works on >= OS 3.0
这使用QuartzCore框架,它只适用于> = OS 3.0
#2
1
you can add some mask image over your webView. in such way you can change form of the visible part of your webView
您可以在webView上添加一些蒙版图像。通过这种方式,您可以更改webView的可见部分的形式
#1
15
Here's how:
//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.*.com/"]]];
//yourView is the UIView's superview, might be the window, or anything you want
[yourView addSubview: webView];
[webView release];
This uses the QuartzCore framework, and it only works on >= OS 3.0
这使用QuartzCore框架,它只适用于> = OS 3.0
#2
1
you can add some mask image over your webView. in such way you can change form of the visible part of your webView
您可以在webView上添加一些蒙版图像。通过这种方式,您可以更改webView的可见部分的形式