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

时间:2009-11-13 04:53:46

标签: iphone

我希望我的webview带有圆角矩形角。

任何帮助?

2 个答案:

答案 0 :(得分: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];

这使用QuartzCore框架,它只适用于&gt; = OS 3.0

答案 1 :(得分:1)

您可以在webView上添加一些蒙版图像。通过这种方式,您可以更改webView的可见部分的形式