开发者

How make webview with Rounded Rectangle corners?

I want my webview with Rounded Rectangle Corners.

Any he开发者_开发问答lp ?


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.stackoverflow.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


you can add some mask image over your webView. in such way you can change form of the visible part of your webView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜